
bin/kernel:     file format elf32-i386


Disassembly of section .text:

c0100000 <kern_entry>:
.text
.globl kern_entry
kern_entry:
    # reload temperate gdt (second time) to remap all physical memory
    # virtual_addr 0~4G=linear_addr&physical_addr -KERNBASE~4G-KERNBASE 
    lgdt REALLOC(__gdtdesc)
c0100000:	0f 01 15 18 00 12 00 	lgdtl  0x120018
    movl $KERNEL_DS, %eax
c0100007:	b8 10 00 00 00       	mov    $0x10,%eax
    movw %ax, %ds
c010000c:	8e d8                	mov    %eax,%ds
    movw %ax, %es
c010000e:	8e c0                	mov    %eax,%es
    movw %ax, %ss
c0100010:	8e d0                	mov    %eax,%ss

    ljmp $KERNEL_CS, $relocated
c0100012:	ea 19 00 10 c0 08 00 	ljmp   $0x8,$0xc0100019

c0100019 <relocated>:

relocated:

    # set ebp, esp
    movl $0x0, %ebp
c0100019:	bd 00 00 00 00       	mov    $0x0,%ebp
    # the kernel stack region is from bootstack -- bootstacktop,
    # the kernel stack size is KSTACKSIZE (8KB)defined in memlayout.h
    movl $bootstacktop, %esp
c010001e:	bc 00 00 12 c0       	mov    $0xc0120000,%esp
    # now kernel stack is ready , call the first C function
    call kern_init
c0100023:	e8 02 00 00 00       	call   c010002a <kern_init>

c0100028 <spin>:

# should never get here
spin:
    jmp spin
c0100028:	eb fe                	jmp    c0100028 <spin>

c010002a <kern_init>:
int kern_init(void) __attribute__((noreturn));
void grade_backtrace(void);
static void lab1_switch_test(void);

int
kern_init(void) {
c010002a:	55                   	push   %ebp
c010002b:	89 e5                	mov    %esp,%ebp
c010002d:	83 ec 28             	sub    $0x28,%esp
    extern char edata[], end[];
    memset(edata, 0, end - edata);
c0100030:	ba b0 1b 12 c0       	mov    $0xc0121bb0,%edx
c0100035:	b8 68 0a 12 c0       	mov    $0xc0120a68,%eax
c010003a:	29 c2                	sub    %eax,%edx
c010003c:	89 d0                	mov    %edx,%eax
c010003e:	89 44 24 08          	mov    %eax,0x8(%esp)
c0100042:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c0100049:	00 
c010004a:	c7 04 24 68 0a 12 c0 	movl   $0xc0120a68,(%esp)
c0100051:	e8 09 8a 00 00       	call   c0108a5f <memset>

    cons_init();                // init the console
c0100056:	e8 80 15 00 00       	call   c01015db <cons_init>

    const char *message = "(THU.CST) os is loading ...";
c010005b:	c7 45 f4 00 8c 10 c0 	movl   $0xc0108c00,-0xc(%ebp)
    cprintf("%s\n\n", message);
c0100062:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100065:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100069:	c7 04 24 1c 8c 10 c0 	movl   $0xc0108c1c,(%esp)
c0100070:	e8 d6 02 00 00       	call   c010034b <cprintf>

    print_kerninfo();
c0100075:	e8 05 08 00 00       	call   c010087f <print_kerninfo>

    grade_backtrace();
c010007a:	e8 95 00 00 00       	call   c0100114 <grade_backtrace>

    pmm_init();                 // init physical memory management
c010007f:	e8 47 4c 00 00       	call   c0104ccb <pmm_init>

    pic_init();                 // init interrupt controller
c0100084:	e8 30 1f 00 00       	call   c0101fb9 <pic_init>
    idt_init();                 // init interrupt descriptor table
c0100089:	e8 82 20 00 00       	call   c0102110 <idt_init>

    vmm_init();                 // init virtual memory management
c010008e:	e8 15 74 00 00       	call   c01074a8 <vmm_init>

    ide_init();                 // init ide devices
c0100093:	e8 74 16 00 00       	call   c010170c <ide_init>
    swap_init();                // init swap
c0100098:	e8 ea 5f 00 00       	call   c0106087 <swap_init>

    clock_init();               // init clock interrupt
c010009d:	e8 ef 0c 00 00       	call   c0100d91 <clock_init>
    intr_enable();              // enable irq interrupt
c01000a2:	e8 80 1e 00 00       	call   c0101f27 <intr_enable>
    //LAB1: CAHLLENGE 1 If you try to do it, uncomment lab1_switch_test()
    // user/kernel mode switch test
    //lab1_switch_test();

    /* do nothing */
    while (1);
c01000a7:	eb fe                	jmp    c01000a7 <kern_init+0x7d>

c01000a9 <grade_backtrace2>:
}

void __attribute__((noinline))
grade_backtrace2(int arg0, int arg1, int arg2, int arg3) {
c01000a9:	55                   	push   %ebp
c01000aa:	89 e5                	mov    %esp,%ebp
c01000ac:	83 ec 18             	sub    $0x18,%esp
    mon_backtrace(0, NULL, NULL);
c01000af:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c01000b6:	00 
c01000b7:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c01000be:	00 
c01000bf:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
c01000c6:	e8 f8 0b 00 00       	call   c0100cc3 <mon_backtrace>
}
c01000cb:	c9                   	leave  
c01000cc:	c3                   	ret    

c01000cd <grade_backtrace1>:

void __attribute__((noinline))
grade_backtrace1(int arg0, int arg1) {
c01000cd:	55                   	push   %ebp
c01000ce:	89 e5                	mov    %esp,%ebp
c01000d0:	53                   	push   %ebx
c01000d1:	83 ec 14             	sub    $0x14,%esp
    grade_backtrace2(arg0, (int)&arg0, arg1, (int)&arg1);
c01000d4:	8d 5d 0c             	lea    0xc(%ebp),%ebx
c01000d7:	8b 4d 0c             	mov    0xc(%ebp),%ecx
c01000da:	8d 55 08             	lea    0x8(%ebp),%edx
c01000dd:	8b 45 08             	mov    0x8(%ebp),%eax
c01000e0:	89 5c 24 0c          	mov    %ebx,0xc(%esp)
c01000e4:	89 4c 24 08          	mov    %ecx,0x8(%esp)
c01000e8:	89 54 24 04          	mov    %edx,0x4(%esp)
c01000ec:	89 04 24             	mov    %eax,(%esp)
c01000ef:	e8 b5 ff ff ff       	call   c01000a9 <grade_backtrace2>
}
c01000f4:	83 c4 14             	add    $0x14,%esp
c01000f7:	5b                   	pop    %ebx
c01000f8:	5d                   	pop    %ebp
c01000f9:	c3                   	ret    

c01000fa <grade_backtrace0>:

void __attribute__((noinline))
grade_backtrace0(int arg0, int arg1, int arg2) {
c01000fa:	55                   	push   %ebp
c01000fb:	89 e5                	mov    %esp,%ebp
c01000fd:	83 ec 18             	sub    $0x18,%esp
    grade_backtrace1(arg0, arg2);
c0100100:	8b 45 10             	mov    0x10(%ebp),%eax
c0100103:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100107:	8b 45 08             	mov    0x8(%ebp),%eax
c010010a:	89 04 24             	mov    %eax,(%esp)
c010010d:	e8 bb ff ff ff       	call   c01000cd <grade_backtrace1>
}
c0100112:	c9                   	leave  
c0100113:	c3                   	ret    

c0100114 <grade_backtrace>:

void
grade_backtrace(void) {
c0100114:	55                   	push   %ebp
c0100115:	89 e5                	mov    %esp,%ebp
c0100117:	83 ec 18             	sub    $0x18,%esp
    grade_backtrace0(0, (int)kern_init, 0xffff0000);
c010011a:	b8 2a 00 10 c0       	mov    $0xc010002a,%eax
c010011f:	c7 44 24 08 00 00 ff 	movl   $0xffff0000,0x8(%esp)
c0100126:	ff 
c0100127:	89 44 24 04          	mov    %eax,0x4(%esp)
c010012b:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
c0100132:	e8 c3 ff ff ff       	call   c01000fa <grade_backtrace0>
}
c0100137:	c9                   	leave  
c0100138:	c3                   	ret    

c0100139 <lab1_print_cur_status>:

static void
lab1_print_cur_status(void) {
c0100139:	55                   	push   %ebp
c010013a:	89 e5                	mov    %esp,%ebp
c010013c:	83 ec 28             	sub    $0x28,%esp
    static int round = 0;
    uint16_t reg1, reg2, reg3, reg4;
    asm volatile (
c010013f:	8c 4d f6             	mov    %cs,-0xa(%ebp)
c0100142:	8c 5d f4             	mov    %ds,-0xc(%ebp)
c0100145:	8c 45 f2             	mov    %es,-0xe(%ebp)
c0100148:	8c 55 f0             	mov    %ss,-0x10(%ebp)
            "mov %%cs, %0;"
            "mov %%ds, %1;"
            "mov %%es, %2;"
            "mov %%ss, %3;"
            : "=m"(reg1), "=m"(reg2), "=m"(reg3), "=m"(reg4));
    cprintf("%d: @ring %d\n", round, reg1 & 3);
c010014b:	0f b7 45 f6          	movzwl -0xa(%ebp),%eax
c010014f:	0f b7 c0             	movzwl %ax,%eax
c0100152:	83 e0 03             	and    $0x3,%eax
c0100155:	89 c2                	mov    %eax,%edx
c0100157:	a1 80 0a 12 c0       	mov    0xc0120a80,%eax
c010015c:	89 54 24 08          	mov    %edx,0x8(%esp)
c0100160:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100164:	c7 04 24 21 8c 10 c0 	movl   $0xc0108c21,(%esp)
c010016b:	e8 db 01 00 00       	call   c010034b <cprintf>
    cprintf("%d:  cs = %x\n", round, reg1);
c0100170:	0f b7 45 f6          	movzwl -0xa(%ebp),%eax
c0100174:	0f b7 d0             	movzwl %ax,%edx
c0100177:	a1 80 0a 12 c0       	mov    0xc0120a80,%eax
c010017c:	89 54 24 08          	mov    %edx,0x8(%esp)
c0100180:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100184:	c7 04 24 2f 8c 10 c0 	movl   $0xc0108c2f,(%esp)
c010018b:	e8 bb 01 00 00       	call   c010034b <cprintf>
    cprintf("%d:  ds = %x\n", round, reg2);
c0100190:	0f b7 45 f4          	movzwl -0xc(%ebp),%eax
c0100194:	0f b7 d0             	movzwl %ax,%edx
c0100197:	a1 80 0a 12 c0       	mov    0xc0120a80,%eax
c010019c:	89 54 24 08          	mov    %edx,0x8(%esp)
c01001a0:	89 44 24 04          	mov    %eax,0x4(%esp)
c01001a4:	c7 04 24 3d 8c 10 c0 	movl   $0xc0108c3d,(%esp)
c01001ab:	e8 9b 01 00 00       	call   c010034b <cprintf>
    cprintf("%d:  es = %x\n", round, reg3);
c01001b0:	0f b7 45 f2          	movzwl -0xe(%ebp),%eax
c01001b4:	0f b7 d0             	movzwl %ax,%edx
c01001b7:	a1 80 0a 12 c0       	mov    0xc0120a80,%eax
c01001bc:	89 54 24 08          	mov    %edx,0x8(%esp)
c01001c0:	89 44 24 04          	mov    %eax,0x4(%esp)
c01001c4:	c7 04 24 4b 8c 10 c0 	movl   $0xc0108c4b,(%esp)
c01001cb:	e8 7b 01 00 00       	call   c010034b <cprintf>
    cprintf("%d:  ss = %x\n", round, reg4);
c01001d0:	0f b7 45 f0          	movzwl -0x10(%ebp),%eax
c01001d4:	0f b7 d0             	movzwl %ax,%edx
c01001d7:	a1 80 0a 12 c0       	mov    0xc0120a80,%eax
c01001dc:	89 54 24 08          	mov    %edx,0x8(%esp)
c01001e0:	89 44 24 04          	mov    %eax,0x4(%esp)
c01001e4:	c7 04 24 59 8c 10 c0 	movl   $0xc0108c59,(%esp)
c01001eb:	e8 5b 01 00 00       	call   c010034b <cprintf>
    round ++;
c01001f0:	a1 80 0a 12 c0       	mov    0xc0120a80,%eax
c01001f5:	83 c0 01             	add    $0x1,%eax
c01001f8:	a3 80 0a 12 c0       	mov    %eax,0xc0120a80
}
c01001fd:	c9                   	leave  
c01001fe:	c3                   	ret    

c01001ff <lab1_switch_to_user>:

static void
lab1_switch_to_user(void) {
c01001ff:	55                   	push   %ebp
c0100200:	89 e5                	mov    %esp,%ebp
    //LAB1 CHALLENGE 1 : TODO
}
c0100202:	5d                   	pop    %ebp
c0100203:	c3                   	ret    

c0100204 <lab1_switch_to_kernel>:

static void
lab1_switch_to_kernel(void) {
c0100204:	55                   	push   %ebp
c0100205:	89 e5                	mov    %esp,%ebp
    //LAB1 CHALLENGE 1 :  TODO
}
c0100207:	5d                   	pop    %ebp
c0100208:	c3                   	ret    

c0100209 <lab1_switch_test>:

static void
lab1_switch_test(void) {
c0100209:	55                   	push   %ebp
c010020a:	89 e5                	mov    %esp,%ebp
c010020c:	83 ec 18             	sub    $0x18,%esp
    lab1_print_cur_status();
c010020f:	e8 25 ff ff ff       	call   c0100139 <lab1_print_cur_status>
    cprintf("+++ switch to  user  mode +++\n");
c0100214:	c7 04 24 68 8c 10 c0 	movl   $0xc0108c68,(%esp)
c010021b:	e8 2b 01 00 00       	call   c010034b <cprintf>
    lab1_switch_to_user();
c0100220:	e8 da ff ff ff       	call   c01001ff <lab1_switch_to_user>
    lab1_print_cur_status();
c0100225:	e8 0f ff ff ff       	call   c0100139 <lab1_print_cur_status>
    cprintf("+++ switch to kernel mode +++\n");
c010022a:	c7 04 24 88 8c 10 c0 	movl   $0xc0108c88,(%esp)
c0100231:	e8 15 01 00 00       	call   c010034b <cprintf>
    lab1_switch_to_kernel();
c0100236:	e8 c9 ff ff ff       	call   c0100204 <lab1_switch_to_kernel>
    lab1_print_cur_status();
c010023b:	e8 f9 fe ff ff       	call   c0100139 <lab1_print_cur_status>
}
c0100240:	c9                   	leave  
c0100241:	c3                   	ret    

c0100242 <readline>:
 * The readline() function returns the text of the line read. If some errors
 * are happened, NULL is returned. The return value is a global variable,
 * thus it should be copied before it is used.
 * */
char *
readline(const char *prompt) {
c0100242:	55                   	push   %ebp
c0100243:	89 e5                	mov    %esp,%ebp
c0100245:	83 ec 28             	sub    $0x28,%esp
    if (prompt != NULL) {
c0100248:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
c010024c:	74 13                	je     c0100261 <readline+0x1f>
        cprintf("%s", prompt);
c010024e:	8b 45 08             	mov    0x8(%ebp),%eax
c0100251:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100255:	c7 04 24 a7 8c 10 c0 	movl   $0xc0108ca7,(%esp)
c010025c:	e8 ea 00 00 00       	call   c010034b <cprintf>
    }
    int i = 0, c;
c0100261:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
    while (1) {
        c = getchar();
c0100268:	e8 66 01 00 00       	call   c01003d3 <getchar>
c010026d:	89 45 f0             	mov    %eax,-0x10(%ebp)
        if (c < 0) {
c0100270:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c0100274:	79 07                	jns    c010027d <readline+0x3b>
            return NULL;
c0100276:	b8 00 00 00 00       	mov    $0x0,%eax
c010027b:	eb 79                	jmp    c01002f6 <readline+0xb4>
        }
        else if (c >= ' ' && i < BUFSIZE - 1) {
c010027d:	83 7d f0 1f          	cmpl   $0x1f,-0x10(%ebp)
c0100281:	7e 28                	jle    c01002ab <readline+0x69>
c0100283:	81 7d f4 fe 03 00 00 	cmpl   $0x3fe,-0xc(%ebp)
c010028a:	7f 1f                	jg     c01002ab <readline+0x69>
            cputchar(c);
c010028c:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010028f:	89 04 24             	mov    %eax,(%esp)
c0100292:	e8 da 00 00 00       	call   c0100371 <cputchar>
            buf[i ++] = c;
c0100297:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010029a:	8d 50 01             	lea    0x1(%eax),%edx
c010029d:	89 55 f4             	mov    %edx,-0xc(%ebp)
c01002a0:	8b 55 f0             	mov    -0x10(%ebp),%edx
c01002a3:	88 90 a0 0a 12 c0    	mov    %dl,-0x3fedf560(%eax)
c01002a9:	eb 46                	jmp    c01002f1 <readline+0xaf>
        }
        else if (c == '\b' && i > 0) {
c01002ab:	83 7d f0 08          	cmpl   $0x8,-0x10(%ebp)
c01002af:	75 17                	jne    c01002c8 <readline+0x86>
c01002b1:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c01002b5:	7e 11                	jle    c01002c8 <readline+0x86>
            cputchar(c);
c01002b7:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01002ba:	89 04 24             	mov    %eax,(%esp)
c01002bd:	e8 af 00 00 00       	call   c0100371 <cputchar>
            i --;
c01002c2:	83 6d f4 01          	subl   $0x1,-0xc(%ebp)
c01002c6:	eb 29                	jmp    c01002f1 <readline+0xaf>
        }
        else if (c == '\n' || c == '\r') {
c01002c8:	83 7d f0 0a          	cmpl   $0xa,-0x10(%ebp)
c01002cc:	74 06                	je     c01002d4 <readline+0x92>
c01002ce:	83 7d f0 0d          	cmpl   $0xd,-0x10(%ebp)
c01002d2:	75 1d                	jne    c01002f1 <readline+0xaf>
            cputchar(c);
c01002d4:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01002d7:	89 04 24             	mov    %eax,(%esp)
c01002da:	e8 92 00 00 00       	call   c0100371 <cputchar>
            buf[i] = '\0';
c01002df:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01002e2:	05 a0 0a 12 c0       	add    $0xc0120aa0,%eax
c01002e7:	c6 00 00             	movb   $0x0,(%eax)
            return buf;
c01002ea:	b8 a0 0a 12 c0       	mov    $0xc0120aa0,%eax
c01002ef:	eb 05                	jmp    c01002f6 <readline+0xb4>
        }
    }
c01002f1:	e9 72 ff ff ff       	jmp    c0100268 <readline+0x26>
}
c01002f6:	c9                   	leave  
c01002f7:	c3                   	ret    

c01002f8 <cputch>:
/* *
 * cputch - writes a single character @c to stdout, and it will
 * increace the value of counter pointed by @cnt.
 * */
static void
cputch(int c, int *cnt) {
c01002f8:	55                   	push   %ebp
c01002f9:	89 e5                	mov    %esp,%ebp
c01002fb:	83 ec 18             	sub    $0x18,%esp
    cons_putc(c);
c01002fe:	8b 45 08             	mov    0x8(%ebp),%eax
c0100301:	89 04 24             	mov    %eax,(%esp)
c0100304:	e8 fe 12 00 00       	call   c0101607 <cons_putc>
    (*cnt) ++;
c0100309:	8b 45 0c             	mov    0xc(%ebp),%eax
c010030c:	8b 00                	mov    (%eax),%eax
c010030e:	8d 50 01             	lea    0x1(%eax),%edx
c0100311:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100314:	89 10                	mov    %edx,(%eax)
}
c0100316:	c9                   	leave  
c0100317:	c3                   	ret    

c0100318 <vcprintf>:
 *
 * Call this function if you are already dealing with a va_list.
 * Or you probably want cprintf() instead.
 * */
int
vcprintf(const char *fmt, va_list ap) {
c0100318:	55                   	push   %ebp
c0100319:	89 e5                	mov    %esp,%ebp
c010031b:	83 ec 28             	sub    $0x28,%esp
    int cnt = 0;
c010031e:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
    vprintfmt((void*)cputch, &cnt, fmt, ap);
c0100325:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100328:	89 44 24 0c          	mov    %eax,0xc(%esp)
c010032c:	8b 45 08             	mov    0x8(%ebp),%eax
c010032f:	89 44 24 08          	mov    %eax,0x8(%esp)
c0100333:	8d 45 f4             	lea    -0xc(%ebp),%eax
c0100336:	89 44 24 04          	mov    %eax,0x4(%esp)
c010033a:	c7 04 24 f8 02 10 c0 	movl   $0xc01002f8,(%esp)
c0100341:	e8 5a 7e 00 00       	call   c01081a0 <vprintfmt>
    return cnt;
c0100346:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c0100349:	c9                   	leave  
c010034a:	c3                   	ret    

c010034b <cprintf>:
 *
 * The return value is the number of characters which would be
 * written to stdout.
 * */
int
cprintf(const char *fmt, ...) {
c010034b:	55                   	push   %ebp
c010034c:	89 e5                	mov    %esp,%ebp
c010034e:	83 ec 28             	sub    $0x28,%esp
    va_list ap;
    int cnt;
    va_start(ap, fmt);
c0100351:	8d 45 0c             	lea    0xc(%ebp),%eax
c0100354:	89 45 f0             	mov    %eax,-0x10(%ebp)
    cnt = vcprintf(fmt, ap);
c0100357:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010035a:	89 44 24 04          	mov    %eax,0x4(%esp)
c010035e:	8b 45 08             	mov    0x8(%ebp),%eax
c0100361:	89 04 24             	mov    %eax,(%esp)
c0100364:	e8 af ff ff ff       	call   c0100318 <vcprintf>
c0100369:	89 45 f4             	mov    %eax,-0xc(%ebp)
    va_end(ap);
    return cnt;
c010036c:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c010036f:	c9                   	leave  
c0100370:	c3                   	ret    

c0100371 <cputchar>:

/* cputchar - writes a single character to stdout */
void
cputchar(int c) {
c0100371:	55                   	push   %ebp
c0100372:	89 e5                	mov    %esp,%ebp
c0100374:	83 ec 18             	sub    $0x18,%esp
    cons_putc(c);
c0100377:	8b 45 08             	mov    0x8(%ebp),%eax
c010037a:	89 04 24             	mov    %eax,(%esp)
c010037d:	e8 85 12 00 00       	call   c0101607 <cons_putc>
}
c0100382:	c9                   	leave  
c0100383:	c3                   	ret    

c0100384 <cputs>:
/* *
 * cputs- writes the string pointed by @str to stdout and
 * appends a newline character.
 * */
int
cputs(const char *str) {
c0100384:	55                   	push   %ebp
c0100385:	89 e5                	mov    %esp,%ebp
c0100387:	83 ec 28             	sub    $0x28,%esp
    int cnt = 0;
c010038a:	c7 45 f0 00 00 00 00 	movl   $0x0,-0x10(%ebp)
    char c;
    while ((c = *str ++) != '\0') {
c0100391:	eb 13                	jmp    c01003a6 <cputs+0x22>
        cputch(c, &cnt);
c0100393:	0f be 45 f7          	movsbl -0x9(%ebp),%eax
c0100397:	8d 55 f0             	lea    -0x10(%ebp),%edx
c010039a:	89 54 24 04          	mov    %edx,0x4(%esp)
c010039e:	89 04 24             	mov    %eax,(%esp)
c01003a1:	e8 52 ff ff ff       	call   c01002f8 <cputch>
 * */
int
cputs(const char *str) {
    int cnt = 0;
    char c;
    while ((c = *str ++) != '\0') {
c01003a6:	8b 45 08             	mov    0x8(%ebp),%eax
c01003a9:	8d 50 01             	lea    0x1(%eax),%edx
c01003ac:	89 55 08             	mov    %edx,0x8(%ebp)
c01003af:	0f b6 00             	movzbl (%eax),%eax
c01003b2:	88 45 f7             	mov    %al,-0x9(%ebp)
c01003b5:	80 7d f7 00          	cmpb   $0x0,-0x9(%ebp)
c01003b9:	75 d8                	jne    c0100393 <cputs+0xf>
        cputch(c, &cnt);
    }
    cputch('\n', &cnt);
c01003bb:	8d 45 f0             	lea    -0x10(%ebp),%eax
c01003be:	89 44 24 04          	mov    %eax,0x4(%esp)
c01003c2:	c7 04 24 0a 00 00 00 	movl   $0xa,(%esp)
c01003c9:	e8 2a ff ff ff       	call   c01002f8 <cputch>
    return cnt;
c01003ce:	8b 45 f0             	mov    -0x10(%ebp),%eax
}
c01003d1:	c9                   	leave  
c01003d2:	c3                   	ret    

c01003d3 <getchar>:

/* getchar - reads a single non-zero character from stdin */
int
getchar(void) {
c01003d3:	55                   	push   %ebp
c01003d4:	89 e5                	mov    %esp,%ebp
c01003d6:	83 ec 18             	sub    $0x18,%esp
    int c;
    while ((c = cons_getc()) == 0)
c01003d9:	e8 65 12 00 00       	call   c0101643 <cons_getc>
c01003de:	89 45 f4             	mov    %eax,-0xc(%ebp)
c01003e1:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c01003e5:	74 f2                	je     c01003d9 <getchar+0x6>
        /* do nothing */;
    return c;
c01003e7:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c01003ea:	c9                   	leave  
c01003eb:	c3                   	ret    

c01003ec <stab_binsearch>:
 *      stab_binsearch(stabs, &left, &right, N_SO, 0xf0100184);
 * will exit setting left = 118, right = 554.
 * */
static void
stab_binsearch(const struct stab *stabs, int *region_left, int *region_right,
           int type, uintptr_t addr) {
c01003ec:	55                   	push   %ebp
c01003ed:	89 e5                	mov    %esp,%ebp
c01003ef:	83 ec 20             	sub    $0x20,%esp
    int l = *region_left, r = *region_right, any_matches = 0;
c01003f2:	8b 45 0c             	mov    0xc(%ebp),%eax
c01003f5:	8b 00                	mov    (%eax),%eax
c01003f7:	89 45 fc             	mov    %eax,-0x4(%ebp)
c01003fa:	8b 45 10             	mov    0x10(%ebp),%eax
c01003fd:	8b 00                	mov    (%eax),%eax
c01003ff:	89 45 f8             	mov    %eax,-0x8(%ebp)
c0100402:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)

    while (l <= r) {
c0100409:	e9 d2 00 00 00       	jmp    c01004e0 <stab_binsearch+0xf4>
        int true_m = (l + r) / 2, m = true_m;
c010040e:	8b 45 f8             	mov    -0x8(%ebp),%eax
c0100411:	8b 55 fc             	mov    -0x4(%ebp),%edx
c0100414:	01 d0                	add    %edx,%eax
c0100416:	89 c2                	mov    %eax,%edx
c0100418:	c1 ea 1f             	shr    $0x1f,%edx
c010041b:	01 d0                	add    %edx,%eax
c010041d:	d1 f8                	sar    %eax
c010041f:	89 45 ec             	mov    %eax,-0x14(%ebp)
c0100422:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0100425:	89 45 f0             	mov    %eax,-0x10(%ebp)

        // search for earliest stab with right type
        while (m >= l && stabs[m].n_type != type) {
c0100428:	eb 04                	jmp    c010042e <stab_binsearch+0x42>
            m --;
c010042a:	83 6d f0 01          	subl   $0x1,-0x10(%ebp)

    while (l <= r) {
        int true_m = (l + r) / 2, m = true_m;

        // search for earliest stab with right type
        while (m >= l && stabs[m].n_type != type) {
c010042e:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0100431:	3b 45 fc             	cmp    -0x4(%ebp),%eax
c0100434:	7c 1f                	jl     c0100455 <stab_binsearch+0x69>
c0100436:	8b 55 f0             	mov    -0x10(%ebp),%edx
c0100439:	89 d0                	mov    %edx,%eax
c010043b:	01 c0                	add    %eax,%eax
c010043d:	01 d0                	add    %edx,%eax
c010043f:	c1 e0 02             	shl    $0x2,%eax
c0100442:	89 c2                	mov    %eax,%edx
c0100444:	8b 45 08             	mov    0x8(%ebp),%eax
c0100447:	01 d0                	add    %edx,%eax
c0100449:	0f b6 40 04          	movzbl 0x4(%eax),%eax
c010044d:	0f b6 c0             	movzbl %al,%eax
c0100450:	3b 45 14             	cmp    0x14(%ebp),%eax
c0100453:	75 d5                	jne    c010042a <stab_binsearch+0x3e>
            m --;
        }
        if (m < l) {    // no match in [l, m]
c0100455:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0100458:	3b 45 fc             	cmp    -0x4(%ebp),%eax
c010045b:	7d 0b                	jge    c0100468 <stab_binsearch+0x7c>
            l = true_m + 1;
c010045d:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0100460:	83 c0 01             	add    $0x1,%eax
c0100463:	89 45 fc             	mov    %eax,-0x4(%ebp)
            continue;
c0100466:	eb 78                	jmp    c01004e0 <stab_binsearch+0xf4>
        }

        // actual binary search
        any_matches = 1;
c0100468:	c7 45 f4 01 00 00 00 	movl   $0x1,-0xc(%ebp)
        if (stabs[m].n_value < addr) {
c010046f:	8b 55 f0             	mov    -0x10(%ebp),%edx
c0100472:	89 d0                	mov    %edx,%eax
c0100474:	01 c0                	add    %eax,%eax
c0100476:	01 d0                	add    %edx,%eax
c0100478:	c1 e0 02             	shl    $0x2,%eax
c010047b:	89 c2                	mov    %eax,%edx
c010047d:	8b 45 08             	mov    0x8(%ebp),%eax
c0100480:	01 d0                	add    %edx,%eax
c0100482:	8b 40 08             	mov    0x8(%eax),%eax
c0100485:	3b 45 18             	cmp    0x18(%ebp),%eax
c0100488:	73 13                	jae    c010049d <stab_binsearch+0xb1>
            *region_left = m;
c010048a:	8b 45 0c             	mov    0xc(%ebp),%eax
c010048d:	8b 55 f0             	mov    -0x10(%ebp),%edx
c0100490:	89 10                	mov    %edx,(%eax)
            l = true_m + 1;
c0100492:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0100495:	83 c0 01             	add    $0x1,%eax
c0100498:	89 45 fc             	mov    %eax,-0x4(%ebp)
c010049b:	eb 43                	jmp    c01004e0 <stab_binsearch+0xf4>
        } else if (stabs[m].n_value > addr) {
c010049d:	8b 55 f0             	mov    -0x10(%ebp),%edx
c01004a0:	89 d0                	mov    %edx,%eax
c01004a2:	01 c0                	add    %eax,%eax
c01004a4:	01 d0                	add    %edx,%eax
c01004a6:	c1 e0 02             	shl    $0x2,%eax
c01004a9:	89 c2                	mov    %eax,%edx
c01004ab:	8b 45 08             	mov    0x8(%ebp),%eax
c01004ae:	01 d0                	add    %edx,%eax
c01004b0:	8b 40 08             	mov    0x8(%eax),%eax
c01004b3:	3b 45 18             	cmp    0x18(%ebp),%eax
c01004b6:	76 16                	jbe    c01004ce <stab_binsearch+0xe2>
            *region_right = m - 1;
c01004b8:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01004bb:	8d 50 ff             	lea    -0x1(%eax),%edx
c01004be:	8b 45 10             	mov    0x10(%ebp),%eax
c01004c1:	89 10                	mov    %edx,(%eax)
            r = m - 1;
c01004c3:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01004c6:	83 e8 01             	sub    $0x1,%eax
c01004c9:	89 45 f8             	mov    %eax,-0x8(%ebp)
c01004cc:	eb 12                	jmp    c01004e0 <stab_binsearch+0xf4>
        } else {
            // exact match for 'addr', but continue loop to find
            // *region_right
            *region_left = m;
c01004ce:	8b 45 0c             	mov    0xc(%ebp),%eax
c01004d1:	8b 55 f0             	mov    -0x10(%ebp),%edx
c01004d4:	89 10                	mov    %edx,(%eax)
            l = m;
c01004d6:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01004d9:	89 45 fc             	mov    %eax,-0x4(%ebp)
            addr ++;
c01004dc:	83 45 18 01          	addl   $0x1,0x18(%ebp)
static void
stab_binsearch(const struct stab *stabs, int *region_left, int *region_right,
           int type, uintptr_t addr) {
    int l = *region_left, r = *region_right, any_matches = 0;

    while (l <= r) {
c01004e0:	8b 45 fc             	mov    -0x4(%ebp),%eax
c01004e3:	3b 45 f8             	cmp    -0x8(%ebp),%eax
c01004e6:	0f 8e 22 ff ff ff    	jle    c010040e <stab_binsearch+0x22>
            l = m;
            addr ++;
        }
    }

    if (!any_matches) {
c01004ec:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c01004f0:	75 0f                	jne    c0100501 <stab_binsearch+0x115>
        *region_right = *region_left - 1;
c01004f2:	8b 45 0c             	mov    0xc(%ebp),%eax
c01004f5:	8b 00                	mov    (%eax),%eax
c01004f7:	8d 50 ff             	lea    -0x1(%eax),%edx
c01004fa:	8b 45 10             	mov    0x10(%ebp),%eax
c01004fd:	89 10                	mov    %edx,(%eax)
c01004ff:	eb 3f                	jmp    c0100540 <stab_binsearch+0x154>
    }
    else {
        // find rightmost region containing 'addr'
        l = *region_right;
c0100501:	8b 45 10             	mov    0x10(%ebp),%eax
c0100504:	8b 00                	mov    (%eax),%eax
c0100506:	89 45 fc             	mov    %eax,-0x4(%ebp)
        for (; l > *region_left && stabs[l].n_type != type; l --)
c0100509:	eb 04                	jmp    c010050f <stab_binsearch+0x123>
c010050b:	83 6d fc 01          	subl   $0x1,-0x4(%ebp)
c010050f:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100512:	8b 00                	mov    (%eax),%eax
c0100514:	3b 45 fc             	cmp    -0x4(%ebp),%eax
c0100517:	7d 1f                	jge    c0100538 <stab_binsearch+0x14c>
c0100519:	8b 55 fc             	mov    -0x4(%ebp),%edx
c010051c:	89 d0                	mov    %edx,%eax
c010051e:	01 c0                	add    %eax,%eax
c0100520:	01 d0                	add    %edx,%eax
c0100522:	c1 e0 02             	shl    $0x2,%eax
c0100525:	89 c2                	mov    %eax,%edx
c0100527:	8b 45 08             	mov    0x8(%ebp),%eax
c010052a:	01 d0                	add    %edx,%eax
c010052c:	0f b6 40 04          	movzbl 0x4(%eax),%eax
c0100530:	0f b6 c0             	movzbl %al,%eax
c0100533:	3b 45 14             	cmp    0x14(%ebp),%eax
c0100536:	75 d3                	jne    c010050b <stab_binsearch+0x11f>
            /* do nothing */;
        *region_left = l;
c0100538:	8b 45 0c             	mov    0xc(%ebp),%eax
c010053b:	8b 55 fc             	mov    -0x4(%ebp),%edx
c010053e:	89 10                	mov    %edx,(%eax)
    }
}
c0100540:	c9                   	leave  
c0100541:	c3                   	ret    

c0100542 <debuginfo_eip>:
 * the specified instruction address, @addr.  Returns 0 if information
 * was found, and negative if not.  But even if it returns negative it
 * has stored some information into '*info'.
 * */
int
debuginfo_eip(uintptr_t addr, struct eipdebuginfo *info) {
c0100542:	55                   	push   %ebp
c0100543:	89 e5                	mov    %esp,%ebp
c0100545:	83 ec 58             	sub    $0x58,%esp
    const struct stab *stabs, *stab_end;
    const char *stabstr, *stabstr_end;

    info->eip_file = "<unknown>";
c0100548:	8b 45 0c             	mov    0xc(%ebp),%eax
c010054b:	c7 00 ac 8c 10 c0    	movl   $0xc0108cac,(%eax)
    info->eip_line = 0;
c0100551:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100554:	c7 40 04 00 00 00 00 	movl   $0x0,0x4(%eax)
    info->eip_fn_name = "<unknown>";
c010055b:	8b 45 0c             	mov    0xc(%ebp),%eax
c010055e:	c7 40 08 ac 8c 10 c0 	movl   $0xc0108cac,0x8(%eax)
    info->eip_fn_namelen = 9;
c0100565:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100568:	c7 40 0c 09 00 00 00 	movl   $0x9,0xc(%eax)
    info->eip_fn_addr = addr;
c010056f:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100572:	8b 55 08             	mov    0x8(%ebp),%edx
c0100575:	89 50 10             	mov    %edx,0x10(%eax)
    info->eip_fn_narg = 0;
c0100578:	8b 45 0c             	mov    0xc(%ebp),%eax
c010057b:	c7 40 14 00 00 00 00 	movl   $0x0,0x14(%eax)

    stabs = __STAB_BEGIN__;
c0100582:	c7 45 f4 64 ab 10 c0 	movl   $0xc010ab64,-0xc(%ebp)
    stab_end = __STAB_END__;
c0100589:	c7 45 f0 dc 98 11 c0 	movl   $0xc01198dc,-0x10(%ebp)
    stabstr = __STABSTR_BEGIN__;
c0100590:	c7 45 ec dd 98 11 c0 	movl   $0xc01198dd,-0x14(%ebp)
    stabstr_end = __STABSTR_END__;
c0100597:	c7 45 e8 66 d1 11 c0 	movl   $0xc011d166,-0x18(%ebp)

    // String table validity checks
    if (stabstr_end <= stabstr || stabstr_end[-1] != 0) {
c010059e:	8b 45 e8             	mov    -0x18(%ebp),%eax
c01005a1:	3b 45 ec             	cmp    -0x14(%ebp),%eax
c01005a4:	76 0d                	jbe    c01005b3 <debuginfo_eip+0x71>
c01005a6:	8b 45 e8             	mov    -0x18(%ebp),%eax
c01005a9:	83 e8 01             	sub    $0x1,%eax
c01005ac:	0f b6 00             	movzbl (%eax),%eax
c01005af:	84 c0                	test   %al,%al
c01005b1:	74 0a                	je     c01005bd <debuginfo_eip+0x7b>
        return -1;
c01005b3:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
c01005b8:	e9 c0 02 00 00       	jmp    c010087d <debuginfo_eip+0x33b>
    // 'eip'.  First, we find the basic source file containing 'eip'.
    // Then, we look in that source file for the function.  Then we look
    // for the line number.

    // Search the entire set of stabs for the source file (type N_SO).
    int lfile = 0, rfile = (stab_end - stabs) - 1;
c01005bd:	c7 45 e4 00 00 00 00 	movl   $0x0,-0x1c(%ebp)
c01005c4:	8b 55 f0             	mov    -0x10(%ebp),%edx
c01005c7:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01005ca:	29 c2                	sub    %eax,%edx
c01005cc:	89 d0                	mov    %edx,%eax
c01005ce:	c1 f8 02             	sar    $0x2,%eax
c01005d1:	69 c0 ab aa aa aa    	imul   $0xaaaaaaab,%eax,%eax
c01005d7:	83 e8 01             	sub    $0x1,%eax
c01005da:	89 45 e0             	mov    %eax,-0x20(%ebp)
    stab_binsearch(stabs, &lfile, &rfile, N_SO, addr);
c01005dd:	8b 45 08             	mov    0x8(%ebp),%eax
c01005e0:	89 44 24 10          	mov    %eax,0x10(%esp)
c01005e4:	c7 44 24 0c 64 00 00 	movl   $0x64,0xc(%esp)
c01005eb:	00 
c01005ec:	8d 45 e0             	lea    -0x20(%ebp),%eax
c01005ef:	89 44 24 08          	mov    %eax,0x8(%esp)
c01005f3:	8d 45 e4             	lea    -0x1c(%ebp),%eax
c01005f6:	89 44 24 04          	mov    %eax,0x4(%esp)
c01005fa:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01005fd:	89 04 24             	mov    %eax,(%esp)
c0100600:	e8 e7 fd ff ff       	call   c01003ec <stab_binsearch>
    if (lfile == 0)
c0100605:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0100608:	85 c0                	test   %eax,%eax
c010060a:	75 0a                	jne    c0100616 <debuginfo_eip+0xd4>
        return -1;
c010060c:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
c0100611:	e9 67 02 00 00       	jmp    c010087d <debuginfo_eip+0x33b>

    // Search within that file's stabs for the function definition
    // (N_FUN).
    int lfun = lfile, rfun = rfile;
c0100616:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0100619:	89 45 dc             	mov    %eax,-0x24(%ebp)
c010061c:	8b 45 e0             	mov    -0x20(%ebp),%eax
c010061f:	89 45 d8             	mov    %eax,-0x28(%ebp)
    int lline, rline;
    stab_binsearch(stabs, &lfun, &rfun, N_FUN, addr);
c0100622:	8b 45 08             	mov    0x8(%ebp),%eax
c0100625:	89 44 24 10          	mov    %eax,0x10(%esp)
c0100629:	c7 44 24 0c 24 00 00 	movl   $0x24,0xc(%esp)
c0100630:	00 
c0100631:	8d 45 d8             	lea    -0x28(%ebp),%eax
c0100634:	89 44 24 08          	mov    %eax,0x8(%esp)
c0100638:	8d 45 dc             	lea    -0x24(%ebp),%eax
c010063b:	89 44 24 04          	mov    %eax,0x4(%esp)
c010063f:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100642:	89 04 24             	mov    %eax,(%esp)
c0100645:	e8 a2 fd ff ff       	call   c01003ec <stab_binsearch>

    if (lfun <= rfun) {
c010064a:	8b 55 dc             	mov    -0x24(%ebp),%edx
c010064d:	8b 45 d8             	mov    -0x28(%ebp),%eax
c0100650:	39 c2                	cmp    %eax,%edx
c0100652:	7f 7c                	jg     c01006d0 <debuginfo_eip+0x18e>
        // stabs[lfun] points to the function name
        // in the string table, but check bounds just in case.
        if (stabs[lfun].n_strx < stabstr_end - stabstr) {
c0100654:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0100657:	89 c2                	mov    %eax,%edx
c0100659:	89 d0                	mov    %edx,%eax
c010065b:	01 c0                	add    %eax,%eax
c010065d:	01 d0                	add    %edx,%eax
c010065f:	c1 e0 02             	shl    $0x2,%eax
c0100662:	89 c2                	mov    %eax,%edx
c0100664:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100667:	01 d0                	add    %edx,%eax
c0100669:	8b 10                	mov    (%eax),%edx
c010066b:	8b 4d e8             	mov    -0x18(%ebp),%ecx
c010066e:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0100671:	29 c1                	sub    %eax,%ecx
c0100673:	89 c8                	mov    %ecx,%eax
c0100675:	39 c2                	cmp    %eax,%edx
c0100677:	73 22                	jae    c010069b <debuginfo_eip+0x159>
            info->eip_fn_name = stabstr + stabs[lfun].n_strx;
c0100679:	8b 45 dc             	mov    -0x24(%ebp),%eax
c010067c:	89 c2                	mov    %eax,%edx
c010067e:	89 d0                	mov    %edx,%eax
c0100680:	01 c0                	add    %eax,%eax
c0100682:	01 d0                	add    %edx,%eax
c0100684:	c1 e0 02             	shl    $0x2,%eax
c0100687:	89 c2                	mov    %eax,%edx
c0100689:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010068c:	01 d0                	add    %edx,%eax
c010068e:	8b 10                	mov    (%eax),%edx
c0100690:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0100693:	01 c2                	add    %eax,%edx
c0100695:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100698:	89 50 08             	mov    %edx,0x8(%eax)
        }
        info->eip_fn_addr = stabs[lfun].n_value;
c010069b:	8b 45 dc             	mov    -0x24(%ebp),%eax
c010069e:	89 c2                	mov    %eax,%edx
c01006a0:	89 d0                	mov    %edx,%eax
c01006a2:	01 c0                	add    %eax,%eax
c01006a4:	01 d0                	add    %edx,%eax
c01006a6:	c1 e0 02             	shl    $0x2,%eax
c01006a9:	89 c2                	mov    %eax,%edx
c01006ab:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01006ae:	01 d0                	add    %edx,%eax
c01006b0:	8b 50 08             	mov    0x8(%eax),%edx
c01006b3:	8b 45 0c             	mov    0xc(%ebp),%eax
c01006b6:	89 50 10             	mov    %edx,0x10(%eax)
        addr -= info->eip_fn_addr;
c01006b9:	8b 45 0c             	mov    0xc(%ebp),%eax
c01006bc:	8b 40 10             	mov    0x10(%eax),%eax
c01006bf:	29 45 08             	sub    %eax,0x8(%ebp)
        // Search within the function definition for the line number.
        lline = lfun;
c01006c2:	8b 45 dc             	mov    -0x24(%ebp),%eax
c01006c5:	89 45 d4             	mov    %eax,-0x2c(%ebp)
        rline = rfun;
c01006c8:	8b 45 d8             	mov    -0x28(%ebp),%eax
c01006cb:	89 45 d0             	mov    %eax,-0x30(%ebp)
c01006ce:	eb 15                	jmp    c01006e5 <debuginfo_eip+0x1a3>
    } else {
        // Couldn't find function stab!  Maybe we're in an assembly
        // file.  Search the whole file for the line number.
        info->eip_fn_addr = addr;
c01006d0:	8b 45 0c             	mov    0xc(%ebp),%eax
c01006d3:	8b 55 08             	mov    0x8(%ebp),%edx
c01006d6:	89 50 10             	mov    %edx,0x10(%eax)
        lline = lfile;
c01006d9:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c01006dc:	89 45 d4             	mov    %eax,-0x2c(%ebp)
        rline = rfile;
c01006df:	8b 45 e0             	mov    -0x20(%ebp),%eax
c01006e2:	89 45 d0             	mov    %eax,-0x30(%ebp)
    }
    info->eip_fn_namelen = strfind(info->eip_fn_name, ':') - info->eip_fn_name;
c01006e5:	8b 45 0c             	mov    0xc(%ebp),%eax
c01006e8:	8b 40 08             	mov    0x8(%eax),%eax
c01006eb:	c7 44 24 04 3a 00 00 	movl   $0x3a,0x4(%esp)
c01006f2:	00 
c01006f3:	89 04 24             	mov    %eax,(%esp)
c01006f6:	e8 d8 81 00 00       	call   c01088d3 <strfind>
c01006fb:	89 c2                	mov    %eax,%edx
c01006fd:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100700:	8b 40 08             	mov    0x8(%eax),%eax
c0100703:	29 c2                	sub    %eax,%edx
c0100705:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100708:	89 50 0c             	mov    %edx,0xc(%eax)

    // Search within [lline, rline] for the line number stab.
    // If found, set info->eip_line to the right line number.
    // If not found, return -1.
    stab_binsearch(stabs, &lline, &rline, N_SLINE, addr);
c010070b:	8b 45 08             	mov    0x8(%ebp),%eax
c010070e:	89 44 24 10          	mov    %eax,0x10(%esp)
c0100712:	c7 44 24 0c 44 00 00 	movl   $0x44,0xc(%esp)
c0100719:	00 
c010071a:	8d 45 d0             	lea    -0x30(%ebp),%eax
c010071d:	89 44 24 08          	mov    %eax,0x8(%esp)
c0100721:	8d 45 d4             	lea    -0x2c(%ebp),%eax
c0100724:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100728:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010072b:	89 04 24             	mov    %eax,(%esp)
c010072e:	e8 b9 fc ff ff       	call   c01003ec <stab_binsearch>
    if (lline <= rline) {
c0100733:	8b 55 d4             	mov    -0x2c(%ebp),%edx
c0100736:	8b 45 d0             	mov    -0x30(%ebp),%eax
c0100739:	39 c2                	cmp    %eax,%edx
c010073b:	7f 24                	jg     c0100761 <debuginfo_eip+0x21f>
        info->eip_line = stabs[rline].n_desc;
c010073d:	8b 45 d0             	mov    -0x30(%ebp),%eax
c0100740:	89 c2                	mov    %eax,%edx
c0100742:	89 d0                	mov    %edx,%eax
c0100744:	01 c0                	add    %eax,%eax
c0100746:	01 d0                	add    %edx,%eax
c0100748:	c1 e0 02             	shl    $0x2,%eax
c010074b:	89 c2                	mov    %eax,%edx
c010074d:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100750:	01 d0                	add    %edx,%eax
c0100752:	0f b7 40 06          	movzwl 0x6(%eax),%eax
c0100756:	0f b7 d0             	movzwl %ax,%edx
c0100759:	8b 45 0c             	mov    0xc(%ebp),%eax
c010075c:	89 50 04             	mov    %edx,0x4(%eax)

    // Search backwards from the line number for the relevant filename stab.
    // We can't just use the "lfile" stab because inlined functions
    // can interpolate code from a different file!
    // Such included source files use the N_SOL stab type.
    while (lline >= lfile
c010075f:	eb 13                	jmp    c0100774 <debuginfo_eip+0x232>
    // If not found, return -1.
    stab_binsearch(stabs, &lline, &rline, N_SLINE, addr);
    if (lline <= rline) {
        info->eip_line = stabs[rline].n_desc;
    } else {
        return -1;
c0100761:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
c0100766:	e9 12 01 00 00       	jmp    c010087d <debuginfo_eip+0x33b>
    // can interpolate code from a different file!
    // Such included source files use the N_SOL stab type.
    while (lline >= lfile
           && stabs[lline].n_type != N_SOL
           && (stabs[lline].n_type != N_SO || !stabs[lline].n_value)) {
        lline --;
c010076b:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c010076e:	83 e8 01             	sub    $0x1,%eax
c0100771:	89 45 d4             	mov    %eax,-0x2c(%ebp)

    // Search backwards from the line number for the relevant filename stab.
    // We can't just use the "lfile" stab because inlined functions
    // can interpolate code from a different file!
    // Such included source files use the N_SOL stab type.
    while (lline >= lfile
c0100774:	8b 55 d4             	mov    -0x2c(%ebp),%edx
c0100777:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c010077a:	39 c2                	cmp    %eax,%edx
c010077c:	7c 56                	jl     c01007d4 <debuginfo_eip+0x292>
           && stabs[lline].n_type != N_SOL
c010077e:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c0100781:	89 c2                	mov    %eax,%edx
c0100783:	89 d0                	mov    %edx,%eax
c0100785:	01 c0                	add    %eax,%eax
c0100787:	01 d0                	add    %edx,%eax
c0100789:	c1 e0 02             	shl    $0x2,%eax
c010078c:	89 c2                	mov    %eax,%edx
c010078e:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100791:	01 d0                	add    %edx,%eax
c0100793:	0f b6 40 04          	movzbl 0x4(%eax),%eax
c0100797:	3c 84                	cmp    $0x84,%al
c0100799:	74 39                	je     c01007d4 <debuginfo_eip+0x292>
           && (stabs[lline].n_type != N_SO || !stabs[lline].n_value)) {
c010079b:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c010079e:	89 c2                	mov    %eax,%edx
c01007a0:	89 d0                	mov    %edx,%eax
c01007a2:	01 c0                	add    %eax,%eax
c01007a4:	01 d0                	add    %edx,%eax
c01007a6:	c1 e0 02             	shl    $0x2,%eax
c01007a9:	89 c2                	mov    %eax,%edx
c01007ab:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01007ae:	01 d0                	add    %edx,%eax
c01007b0:	0f b6 40 04          	movzbl 0x4(%eax),%eax
c01007b4:	3c 64                	cmp    $0x64,%al
c01007b6:	75 b3                	jne    c010076b <debuginfo_eip+0x229>
c01007b8:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c01007bb:	89 c2                	mov    %eax,%edx
c01007bd:	89 d0                	mov    %edx,%eax
c01007bf:	01 c0                	add    %eax,%eax
c01007c1:	01 d0                	add    %edx,%eax
c01007c3:	c1 e0 02             	shl    $0x2,%eax
c01007c6:	89 c2                	mov    %eax,%edx
c01007c8:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01007cb:	01 d0                	add    %edx,%eax
c01007cd:	8b 40 08             	mov    0x8(%eax),%eax
c01007d0:	85 c0                	test   %eax,%eax
c01007d2:	74 97                	je     c010076b <debuginfo_eip+0x229>
        lline --;
    }
    if (lline >= lfile && stabs[lline].n_strx < stabstr_end - stabstr) {
c01007d4:	8b 55 d4             	mov    -0x2c(%ebp),%edx
c01007d7:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c01007da:	39 c2                	cmp    %eax,%edx
c01007dc:	7c 46                	jl     c0100824 <debuginfo_eip+0x2e2>
c01007de:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c01007e1:	89 c2                	mov    %eax,%edx
c01007e3:	89 d0                	mov    %edx,%eax
c01007e5:	01 c0                	add    %eax,%eax
c01007e7:	01 d0                	add    %edx,%eax
c01007e9:	c1 e0 02             	shl    $0x2,%eax
c01007ec:	89 c2                	mov    %eax,%edx
c01007ee:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01007f1:	01 d0                	add    %edx,%eax
c01007f3:	8b 10                	mov    (%eax),%edx
c01007f5:	8b 4d e8             	mov    -0x18(%ebp),%ecx
c01007f8:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01007fb:	29 c1                	sub    %eax,%ecx
c01007fd:	89 c8                	mov    %ecx,%eax
c01007ff:	39 c2                	cmp    %eax,%edx
c0100801:	73 21                	jae    c0100824 <debuginfo_eip+0x2e2>
        info->eip_file = stabstr + stabs[lline].n_strx;
c0100803:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c0100806:	89 c2                	mov    %eax,%edx
c0100808:	89 d0                	mov    %edx,%eax
c010080a:	01 c0                	add    %eax,%eax
c010080c:	01 d0                	add    %edx,%eax
c010080e:	c1 e0 02             	shl    $0x2,%eax
c0100811:	89 c2                	mov    %eax,%edx
c0100813:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100816:	01 d0                	add    %edx,%eax
c0100818:	8b 10                	mov    (%eax),%edx
c010081a:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010081d:	01 c2                	add    %eax,%edx
c010081f:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100822:	89 10                	mov    %edx,(%eax)
    }

    // Set eip_fn_narg to the number of arguments taken by the function,
    // or 0 if there was no containing function.
    if (lfun < rfun) {
c0100824:	8b 55 dc             	mov    -0x24(%ebp),%edx
c0100827:	8b 45 d8             	mov    -0x28(%ebp),%eax
c010082a:	39 c2                	cmp    %eax,%edx
c010082c:	7d 4a                	jge    c0100878 <debuginfo_eip+0x336>
        for (lline = lfun + 1;
c010082e:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0100831:	83 c0 01             	add    $0x1,%eax
c0100834:	89 45 d4             	mov    %eax,-0x2c(%ebp)
c0100837:	eb 18                	jmp    c0100851 <debuginfo_eip+0x30f>
             lline < rfun && stabs[lline].n_type == N_PSYM;
             lline ++) {
            info->eip_fn_narg ++;
c0100839:	8b 45 0c             	mov    0xc(%ebp),%eax
c010083c:	8b 40 14             	mov    0x14(%eax),%eax
c010083f:	8d 50 01             	lea    0x1(%eax),%edx
c0100842:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100845:	89 50 14             	mov    %edx,0x14(%eax)
    // Set eip_fn_narg to the number of arguments taken by the function,
    // or 0 if there was no containing function.
    if (lfun < rfun) {
        for (lline = lfun + 1;
             lline < rfun && stabs[lline].n_type == N_PSYM;
             lline ++) {
c0100848:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c010084b:	83 c0 01             	add    $0x1,%eax
c010084e:	89 45 d4             	mov    %eax,-0x2c(%ebp)

    // Set eip_fn_narg to the number of arguments taken by the function,
    // or 0 if there was no containing function.
    if (lfun < rfun) {
        for (lline = lfun + 1;
             lline < rfun && stabs[lline].n_type == N_PSYM;
c0100851:	8b 55 d4             	mov    -0x2c(%ebp),%edx
c0100854:	8b 45 d8             	mov    -0x28(%ebp),%eax
    }

    // Set eip_fn_narg to the number of arguments taken by the function,
    // or 0 if there was no containing function.
    if (lfun < rfun) {
        for (lline = lfun + 1;
c0100857:	39 c2                	cmp    %eax,%edx
c0100859:	7d 1d                	jge    c0100878 <debuginfo_eip+0x336>
             lline < rfun && stabs[lline].n_type == N_PSYM;
c010085b:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c010085e:	89 c2                	mov    %eax,%edx
c0100860:	89 d0                	mov    %edx,%eax
c0100862:	01 c0                	add    %eax,%eax
c0100864:	01 d0                	add    %edx,%eax
c0100866:	c1 e0 02             	shl    $0x2,%eax
c0100869:	89 c2                	mov    %eax,%edx
c010086b:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010086e:	01 d0                	add    %edx,%eax
c0100870:	0f b6 40 04          	movzbl 0x4(%eax),%eax
c0100874:	3c a0                	cmp    $0xa0,%al
c0100876:	74 c1                	je     c0100839 <debuginfo_eip+0x2f7>
             lline ++) {
            info->eip_fn_narg ++;
        }
    }
    return 0;
c0100878:	b8 00 00 00 00       	mov    $0x0,%eax
}
c010087d:	c9                   	leave  
c010087e:	c3                   	ret    

c010087f <print_kerninfo>:
 * print_kerninfo - print the information about kernel, including the location
 * of kernel entry, the start addresses of data and text segements, the start
 * address of free memory and how many memory that kernel has used.
 * */
void
print_kerninfo(void) {
c010087f:	55                   	push   %ebp
c0100880:	89 e5                	mov    %esp,%ebp
c0100882:	83 ec 18             	sub    $0x18,%esp
    extern char etext[], edata[], end[], kern_init[];
    cprintf("Special kernel symbols:\n");
c0100885:	c7 04 24 b6 8c 10 c0 	movl   $0xc0108cb6,(%esp)
c010088c:	e8 ba fa ff ff       	call   c010034b <cprintf>
    cprintf("  entry  0x%08x (phys)\n", kern_init);
c0100891:	c7 44 24 04 2a 00 10 	movl   $0xc010002a,0x4(%esp)
c0100898:	c0 
c0100899:	c7 04 24 cf 8c 10 c0 	movl   $0xc0108ccf,(%esp)
c01008a0:	e8 a6 fa ff ff       	call   c010034b <cprintf>
    cprintf("  etext  0x%08x (phys)\n", etext);
c01008a5:	c7 44 24 04 e8 8b 10 	movl   $0xc0108be8,0x4(%esp)
c01008ac:	c0 
c01008ad:	c7 04 24 e7 8c 10 c0 	movl   $0xc0108ce7,(%esp)
c01008b4:	e8 92 fa ff ff       	call   c010034b <cprintf>
    cprintf("  edata  0x%08x (phys)\n", edata);
c01008b9:	c7 44 24 04 68 0a 12 	movl   $0xc0120a68,0x4(%esp)
c01008c0:	c0 
c01008c1:	c7 04 24 ff 8c 10 c0 	movl   $0xc0108cff,(%esp)
c01008c8:	e8 7e fa ff ff       	call   c010034b <cprintf>
    cprintf("  end    0x%08x (phys)\n", end);
c01008cd:	c7 44 24 04 b0 1b 12 	movl   $0xc0121bb0,0x4(%esp)
c01008d4:	c0 
c01008d5:	c7 04 24 17 8d 10 c0 	movl   $0xc0108d17,(%esp)
c01008dc:	e8 6a fa ff ff       	call   c010034b <cprintf>
    cprintf("Kernel executable memory footprint: %dKB\n", (end - kern_init + 1023)/1024);
c01008e1:	b8 b0 1b 12 c0       	mov    $0xc0121bb0,%eax
c01008e6:	8d 90 ff 03 00 00    	lea    0x3ff(%eax),%edx
c01008ec:	b8 2a 00 10 c0       	mov    $0xc010002a,%eax
c01008f1:	29 c2                	sub    %eax,%edx
c01008f3:	89 d0                	mov    %edx,%eax
c01008f5:	8d 90 ff 03 00 00    	lea    0x3ff(%eax),%edx
c01008fb:	85 c0                	test   %eax,%eax
c01008fd:	0f 48 c2             	cmovs  %edx,%eax
c0100900:	c1 f8 0a             	sar    $0xa,%eax
c0100903:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100907:	c7 04 24 30 8d 10 c0 	movl   $0xc0108d30,(%esp)
c010090e:	e8 38 fa ff ff       	call   c010034b <cprintf>
}
c0100913:	c9                   	leave  
c0100914:	c3                   	ret    

c0100915 <print_debuginfo>:
/* *
 * print_debuginfo - read and print the stat information for the address @eip,
 * and info.eip_fn_addr should be the first address of the related function.
 * */
void
print_debuginfo(uintptr_t eip) {
c0100915:	55                   	push   %ebp
c0100916:	89 e5                	mov    %esp,%ebp
c0100918:	81 ec 48 01 00 00    	sub    $0x148,%esp
    struct eipdebuginfo info;
    if (debuginfo_eip(eip, &info) != 0) {
c010091e:	8d 45 dc             	lea    -0x24(%ebp),%eax
c0100921:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100925:	8b 45 08             	mov    0x8(%ebp),%eax
c0100928:	89 04 24             	mov    %eax,(%esp)
c010092b:	e8 12 fc ff ff       	call   c0100542 <debuginfo_eip>
c0100930:	85 c0                	test   %eax,%eax
c0100932:	74 15                	je     c0100949 <print_debuginfo+0x34>
        cprintf("    <unknow>: -- 0x%08x --\n", eip);
c0100934:	8b 45 08             	mov    0x8(%ebp),%eax
c0100937:	89 44 24 04          	mov    %eax,0x4(%esp)
c010093b:	c7 04 24 5a 8d 10 c0 	movl   $0xc0108d5a,(%esp)
c0100942:	e8 04 fa ff ff       	call   c010034b <cprintf>
c0100947:	eb 6d                	jmp    c01009b6 <print_debuginfo+0xa1>
    }
    else {
        char fnname[256];
        int j;
        for (j = 0; j < info.eip_fn_namelen; j ++) {
c0100949:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
c0100950:	eb 1c                	jmp    c010096e <print_debuginfo+0x59>
            fnname[j] = info.eip_fn_name[j];
c0100952:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c0100955:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100958:	01 d0                	add    %edx,%eax
c010095a:	0f b6 00             	movzbl (%eax),%eax
c010095d:	8d 8d dc fe ff ff    	lea    -0x124(%ebp),%ecx
c0100963:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0100966:	01 ca                	add    %ecx,%edx
c0100968:	88 02                	mov    %al,(%edx)
        cprintf("    <unknow>: -- 0x%08x --\n", eip);
    }
    else {
        char fnname[256];
        int j;
        for (j = 0; j < info.eip_fn_namelen; j ++) {
c010096a:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
c010096e:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0100971:	3b 45 f4             	cmp    -0xc(%ebp),%eax
c0100974:	7f dc                	jg     c0100952 <print_debuginfo+0x3d>
            fnname[j] = info.eip_fn_name[j];
        }
        fnname[j] = '\0';
c0100976:	8d 95 dc fe ff ff    	lea    -0x124(%ebp),%edx
c010097c:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010097f:	01 d0                	add    %edx,%eax
c0100981:	c6 00 00             	movb   $0x0,(%eax)
        cprintf("    %s:%d: %s+%d\n", info.eip_file, info.eip_line,
                fnname, eip - info.eip_fn_addr);
c0100984:	8b 45 ec             	mov    -0x14(%ebp),%eax
        int j;
        for (j = 0; j < info.eip_fn_namelen; j ++) {
            fnname[j] = info.eip_fn_name[j];
        }
        fnname[j] = '\0';
        cprintf("    %s:%d: %s+%d\n", info.eip_file, info.eip_line,
c0100987:	8b 55 08             	mov    0x8(%ebp),%edx
c010098a:	89 d1                	mov    %edx,%ecx
c010098c:	29 c1                	sub    %eax,%ecx
c010098e:	8b 55 e0             	mov    -0x20(%ebp),%edx
c0100991:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0100994:	89 4c 24 10          	mov    %ecx,0x10(%esp)
c0100998:	8d 8d dc fe ff ff    	lea    -0x124(%ebp),%ecx
c010099e:	89 4c 24 0c          	mov    %ecx,0xc(%esp)
c01009a2:	89 54 24 08          	mov    %edx,0x8(%esp)
c01009a6:	89 44 24 04          	mov    %eax,0x4(%esp)
c01009aa:	c7 04 24 76 8d 10 c0 	movl   $0xc0108d76,(%esp)
c01009b1:	e8 95 f9 ff ff       	call   c010034b <cprintf>
                fnname, eip - info.eip_fn_addr);
    }
}
c01009b6:	c9                   	leave  
c01009b7:	c3                   	ret    

c01009b8 <read_eip>:

static __noinline uint32_t
read_eip(void) {
c01009b8:	55                   	push   %ebp
c01009b9:	89 e5                	mov    %esp,%ebp
c01009bb:	83 ec 10             	sub    $0x10,%esp
    uint32_t eip;
    asm volatile("movl 4(%%ebp), %0" : "=r" (eip));
c01009be:	8b 45 04             	mov    0x4(%ebp),%eax
c01009c1:	89 45 fc             	mov    %eax,-0x4(%ebp)
    return eip;
c01009c4:	8b 45 fc             	mov    -0x4(%ebp),%eax
}
c01009c7:	c9                   	leave  
c01009c8:	c3                   	ret    

c01009c9 <print_stackframe>:
 *
 * Note that, the length of ebp-chain is limited. In boot/bootasm.S, before jumping
 * to the kernel entry, the value of ebp has been set to zero, that's the boundary.
 * */
void
print_stackframe(void) {
c01009c9:	55                   	push   %ebp
c01009ca:	89 e5                	mov    %esp,%ebp
c01009cc:	83 ec 38             	sub    $0x38,%esp
}

static inline uint32_t
read_ebp(void) {
    uint32_t ebp;
    asm volatile ("movl %%ebp, %0" : "=r" (ebp));
c01009cf:	89 e8                	mov    %ebp,%eax
c01009d1:	89 45 e0             	mov    %eax,-0x20(%ebp)
    return ebp;
c01009d4:	8b 45 e0             	mov    -0x20(%ebp),%eax
      *    (3.4) call print_debuginfo(eip-1) to print the C calling function name and line number, etc.
      *    (3.5) popup a calling stackframe
      *           NOTICE: the calling funciton's return addr eip  = ss:[ebp+4]
      *                   the calling funciton's ebp = ss:[ebp]
      */
    uint32_t ebp = read_ebp(), eip = read_eip();
c01009d7:	89 45 f4             	mov    %eax,-0xc(%ebp)
c01009da:	e8 d9 ff ff ff       	call   c01009b8 <read_eip>
c01009df:	89 45 f0             	mov    %eax,-0x10(%ebp)

    int i, j;
    for (i = 0; ebp != 0 && i < STACKFRAME_DEPTH; i ++) {
c01009e2:	c7 45 ec 00 00 00 00 	movl   $0x0,-0x14(%ebp)
c01009e9:	e9 88 00 00 00       	jmp    c0100a76 <print_stackframe+0xad>
        cprintf("ebp:0x%08x eip:0x%08x args:", ebp, eip);
c01009ee:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01009f1:	89 44 24 08          	mov    %eax,0x8(%esp)
c01009f5:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01009f8:	89 44 24 04          	mov    %eax,0x4(%esp)
c01009fc:	c7 04 24 88 8d 10 c0 	movl   $0xc0108d88,(%esp)
c0100a03:	e8 43 f9 ff ff       	call   c010034b <cprintf>
        uint32_t *args = (uint32_t *)ebp + 2;
c0100a08:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100a0b:	83 c0 08             	add    $0x8,%eax
c0100a0e:	89 45 e4             	mov    %eax,-0x1c(%ebp)
        for (j = 0; j < 4; j ++) {
c0100a11:	c7 45 e8 00 00 00 00 	movl   $0x0,-0x18(%ebp)
c0100a18:	eb 25                	jmp    c0100a3f <print_stackframe+0x76>
            cprintf("0x%08x ", args[j]);
c0100a1a:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0100a1d:	8d 14 85 00 00 00 00 	lea    0x0(,%eax,4),%edx
c0100a24:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0100a27:	01 d0                	add    %edx,%eax
c0100a29:	8b 00                	mov    (%eax),%eax
c0100a2b:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100a2f:	c7 04 24 a4 8d 10 c0 	movl   $0xc0108da4,(%esp)
c0100a36:	e8 10 f9 ff ff       	call   c010034b <cprintf>

    int i, j;
    for (i = 0; ebp != 0 && i < STACKFRAME_DEPTH; i ++) {
        cprintf("ebp:0x%08x eip:0x%08x args:", ebp, eip);
        uint32_t *args = (uint32_t *)ebp + 2;
        for (j = 0; j < 4; j ++) {
c0100a3b:	83 45 e8 01          	addl   $0x1,-0x18(%ebp)
c0100a3f:	83 7d e8 03          	cmpl   $0x3,-0x18(%ebp)
c0100a43:	7e d5                	jle    c0100a1a <print_stackframe+0x51>
            cprintf("0x%08x ", args[j]);
        }
        cprintf("\n");
c0100a45:	c7 04 24 ac 8d 10 c0 	movl   $0xc0108dac,(%esp)
c0100a4c:	e8 fa f8 ff ff       	call   c010034b <cprintf>
        print_debuginfo(eip - 1);
c0100a51:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0100a54:	83 e8 01             	sub    $0x1,%eax
c0100a57:	89 04 24             	mov    %eax,(%esp)
c0100a5a:	e8 b6 fe ff ff       	call   c0100915 <print_debuginfo>
        eip = ((uint32_t *)ebp)[1];
c0100a5f:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100a62:	83 c0 04             	add    $0x4,%eax
c0100a65:	8b 00                	mov    (%eax),%eax
c0100a67:	89 45 f0             	mov    %eax,-0x10(%ebp)
        ebp = ((uint32_t *)ebp)[0];
c0100a6a:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100a6d:	8b 00                	mov    (%eax),%eax
c0100a6f:	89 45 f4             	mov    %eax,-0xc(%ebp)
      *                   the calling funciton's ebp = ss:[ebp]
      */
    uint32_t ebp = read_ebp(), eip = read_eip();

    int i, j;
    for (i = 0; ebp != 0 && i < STACKFRAME_DEPTH; i ++) {
c0100a72:	83 45 ec 01          	addl   $0x1,-0x14(%ebp)
c0100a76:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0100a7a:	74 0a                	je     c0100a86 <print_stackframe+0xbd>
c0100a7c:	83 7d ec 13          	cmpl   $0x13,-0x14(%ebp)
c0100a80:	0f 8e 68 ff ff ff    	jle    c01009ee <print_stackframe+0x25>
        cprintf("\n");
        print_debuginfo(eip - 1);
        eip = ((uint32_t *)ebp)[1];
        ebp = ((uint32_t *)ebp)[0];
    }
}
c0100a86:	c9                   	leave  
c0100a87:	c3                   	ret    

c0100a88 <parse>:
#define MAXARGS         16
#define WHITESPACE      " \t\n\r"

/* parse - parse the command buffer into whitespace-separated arguments */
static int
parse(char *buf, char **argv) {
c0100a88:	55                   	push   %ebp
c0100a89:	89 e5                	mov    %esp,%ebp
c0100a8b:	83 ec 28             	sub    $0x28,%esp
    int argc = 0;
c0100a8e:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
    while (1) {
        // find global whitespace
        while (*buf != '\0' && strchr(WHITESPACE, *buf) != NULL) {
c0100a95:	eb 0c                	jmp    c0100aa3 <parse+0x1b>
            *buf ++ = '\0';
c0100a97:	8b 45 08             	mov    0x8(%ebp),%eax
c0100a9a:	8d 50 01             	lea    0x1(%eax),%edx
c0100a9d:	89 55 08             	mov    %edx,0x8(%ebp)
c0100aa0:	c6 00 00             	movb   $0x0,(%eax)
static int
parse(char *buf, char **argv) {
    int argc = 0;
    while (1) {
        // find global whitespace
        while (*buf != '\0' && strchr(WHITESPACE, *buf) != NULL) {
c0100aa3:	8b 45 08             	mov    0x8(%ebp),%eax
c0100aa6:	0f b6 00             	movzbl (%eax),%eax
c0100aa9:	84 c0                	test   %al,%al
c0100aab:	74 1d                	je     c0100aca <parse+0x42>
c0100aad:	8b 45 08             	mov    0x8(%ebp),%eax
c0100ab0:	0f b6 00             	movzbl (%eax),%eax
c0100ab3:	0f be c0             	movsbl %al,%eax
c0100ab6:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100aba:	c7 04 24 30 8e 10 c0 	movl   $0xc0108e30,(%esp)
c0100ac1:	e8 da 7d 00 00       	call   c01088a0 <strchr>
c0100ac6:	85 c0                	test   %eax,%eax
c0100ac8:	75 cd                	jne    c0100a97 <parse+0xf>
            *buf ++ = '\0';
        }
        if (*buf == '\0') {
c0100aca:	8b 45 08             	mov    0x8(%ebp),%eax
c0100acd:	0f b6 00             	movzbl (%eax),%eax
c0100ad0:	84 c0                	test   %al,%al
c0100ad2:	75 02                	jne    c0100ad6 <parse+0x4e>
            break;
c0100ad4:	eb 67                	jmp    c0100b3d <parse+0xb5>
        }

        // save and scan past next arg
        if (argc == MAXARGS - 1) {
c0100ad6:	83 7d f4 0f          	cmpl   $0xf,-0xc(%ebp)
c0100ada:	75 14                	jne    c0100af0 <parse+0x68>
            cprintf("Too many arguments (max %d).\n", MAXARGS);
c0100adc:	c7 44 24 04 10 00 00 	movl   $0x10,0x4(%esp)
c0100ae3:	00 
c0100ae4:	c7 04 24 35 8e 10 c0 	movl   $0xc0108e35,(%esp)
c0100aeb:	e8 5b f8 ff ff       	call   c010034b <cprintf>
        }
        argv[argc ++] = buf;
c0100af0:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100af3:	8d 50 01             	lea    0x1(%eax),%edx
c0100af6:	89 55 f4             	mov    %edx,-0xc(%ebp)
c0100af9:	8d 14 85 00 00 00 00 	lea    0x0(,%eax,4),%edx
c0100b00:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100b03:	01 c2                	add    %eax,%edx
c0100b05:	8b 45 08             	mov    0x8(%ebp),%eax
c0100b08:	89 02                	mov    %eax,(%edx)
        while (*buf != '\0' && strchr(WHITESPACE, *buf) == NULL) {
c0100b0a:	eb 04                	jmp    c0100b10 <parse+0x88>
            buf ++;
c0100b0c:	83 45 08 01          	addl   $0x1,0x8(%ebp)
        // save and scan past next arg
        if (argc == MAXARGS - 1) {
            cprintf("Too many arguments (max %d).\n", MAXARGS);
        }
        argv[argc ++] = buf;
        while (*buf != '\0' && strchr(WHITESPACE, *buf) == NULL) {
c0100b10:	8b 45 08             	mov    0x8(%ebp),%eax
c0100b13:	0f b6 00             	movzbl (%eax),%eax
c0100b16:	84 c0                	test   %al,%al
c0100b18:	74 1d                	je     c0100b37 <parse+0xaf>
c0100b1a:	8b 45 08             	mov    0x8(%ebp),%eax
c0100b1d:	0f b6 00             	movzbl (%eax),%eax
c0100b20:	0f be c0             	movsbl %al,%eax
c0100b23:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100b27:	c7 04 24 30 8e 10 c0 	movl   $0xc0108e30,(%esp)
c0100b2e:	e8 6d 7d 00 00       	call   c01088a0 <strchr>
c0100b33:	85 c0                	test   %eax,%eax
c0100b35:	74 d5                	je     c0100b0c <parse+0x84>
            buf ++;
        }
    }
c0100b37:	90                   	nop
static int
parse(char *buf, char **argv) {
    int argc = 0;
    while (1) {
        // find global whitespace
        while (*buf != '\0' && strchr(WHITESPACE, *buf) != NULL) {
c0100b38:	e9 66 ff ff ff       	jmp    c0100aa3 <parse+0x1b>
        argv[argc ++] = buf;
        while (*buf != '\0' && strchr(WHITESPACE, *buf) == NULL) {
            buf ++;
        }
    }
    return argc;
c0100b3d:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c0100b40:	c9                   	leave  
c0100b41:	c3                   	ret    

c0100b42 <runcmd>:
/* *
 * runcmd - parse the input string, split it into separated arguments
 * and then lookup and invoke some related commands/
 * */
static int
runcmd(char *buf, struct trapframe *tf) {
c0100b42:	55                   	push   %ebp
c0100b43:	89 e5                	mov    %esp,%ebp
c0100b45:	83 ec 68             	sub    $0x68,%esp
    char *argv[MAXARGS];
    int argc = parse(buf, argv);
c0100b48:	8d 45 b0             	lea    -0x50(%ebp),%eax
c0100b4b:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100b4f:	8b 45 08             	mov    0x8(%ebp),%eax
c0100b52:	89 04 24             	mov    %eax,(%esp)
c0100b55:	e8 2e ff ff ff       	call   c0100a88 <parse>
c0100b5a:	89 45 f0             	mov    %eax,-0x10(%ebp)
    if (argc == 0) {
c0100b5d:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c0100b61:	75 0a                	jne    c0100b6d <runcmd+0x2b>
        return 0;
c0100b63:	b8 00 00 00 00       	mov    $0x0,%eax
c0100b68:	e9 85 00 00 00       	jmp    c0100bf2 <runcmd+0xb0>
    }
    int i;
    for (i = 0; i < NCOMMANDS; i ++) {
c0100b6d:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
c0100b74:	eb 5c                	jmp    c0100bd2 <runcmd+0x90>
        if (strcmp(commands[i].name, argv[0]) == 0) {
c0100b76:	8b 4d b0             	mov    -0x50(%ebp),%ecx
c0100b79:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0100b7c:	89 d0                	mov    %edx,%eax
c0100b7e:	01 c0                	add    %eax,%eax
c0100b80:	01 d0                	add    %edx,%eax
c0100b82:	c1 e0 02             	shl    $0x2,%eax
c0100b85:	05 20 00 12 c0       	add    $0xc0120020,%eax
c0100b8a:	8b 00                	mov    (%eax),%eax
c0100b8c:	89 4c 24 04          	mov    %ecx,0x4(%esp)
c0100b90:	89 04 24             	mov    %eax,(%esp)
c0100b93:	e8 69 7c 00 00       	call   c0108801 <strcmp>
c0100b98:	85 c0                	test   %eax,%eax
c0100b9a:	75 32                	jne    c0100bce <runcmd+0x8c>
            return commands[i].func(argc - 1, argv + 1, tf);
c0100b9c:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0100b9f:	89 d0                	mov    %edx,%eax
c0100ba1:	01 c0                	add    %eax,%eax
c0100ba3:	01 d0                	add    %edx,%eax
c0100ba5:	c1 e0 02             	shl    $0x2,%eax
c0100ba8:	05 20 00 12 c0       	add    $0xc0120020,%eax
c0100bad:	8b 40 08             	mov    0x8(%eax),%eax
c0100bb0:	8b 55 f0             	mov    -0x10(%ebp),%edx
c0100bb3:	8d 4a ff             	lea    -0x1(%edx),%ecx
c0100bb6:	8b 55 0c             	mov    0xc(%ebp),%edx
c0100bb9:	89 54 24 08          	mov    %edx,0x8(%esp)
c0100bbd:	8d 55 b0             	lea    -0x50(%ebp),%edx
c0100bc0:	83 c2 04             	add    $0x4,%edx
c0100bc3:	89 54 24 04          	mov    %edx,0x4(%esp)
c0100bc7:	89 0c 24             	mov    %ecx,(%esp)
c0100bca:	ff d0                	call   *%eax
c0100bcc:	eb 24                	jmp    c0100bf2 <runcmd+0xb0>
    int argc = parse(buf, argv);
    if (argc == 0) {
        return 0;
    }
    int i;
    for (i = 0; i < NCOMMANDS; i ++) {
c0100bce:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
c0100bd2:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100bd5:	83 f8 02             	cmp    $0x2,%eax
c0100bd8:	76 9c                	jbe    c0100b76 <runcmd+0x34>
        if (strcmp(commands[i].name, argv[0]) == 0) {
            return commands[i].func(argc - 1, argv + 1, tf);
        }
    }
    cprintf("Unknown command '%s'\n", argv[0]);
c0100bda:	8b 45 b0             	mov    -0x50(%ebp),%eax
c0100bdd:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100be1:	c7 04 24 53 8e 10 c0 	movl   $0xc0108e53,(%esp)
c0100be8:	e8 5e f7 ff ff       	call   c010034b <cprintf>
    return 0;
c0100bed:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0100bf2:	c9                   	leave  
c0100bf3:	c3                   	ret    

c0100bf4 <kmonitor>:

/***** Implementations of basic kernel monitor commands *****/

void
kmonitor(struct trapframe *tf) {
c0100bf4:	55                   	push   %ebp
c0100bf5:	89 e5                	mov    %esp,%ebp
c0100bf7:	83 ec 28             	sub    $0x28,%esp
    cprintf("Welcome to the kernel debug monitor!!\n");
c0100bfa:	c7 04 24 6c 8e 10 c0 	movl   $0xc0108e6c,(%esp)
c0100c01:	e8 45 f7 ff ff       	call   c010034b <cprintf>
    cprintf("Type 'help' for a list of commands.\n");
c0100c06:	c7 04 24 94 8e 10 c0 	movl   $0xc0108e94,(%esp)
c0100c0d:	e8 39 f7 ff ff       	call   c010034b <cprintf>

    if (tf != NULL) {
c0100c12:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
c0100c16:	74 0b                	je     c0100c23 <kmonitor+0x2f>
        print_trapframe(tf);
c0100c18:	8b 45 08             	mov    0x8(%ebp),%eax
c0100c1b:	89 04 24             	mov    %eax,(%esp)
c0100c1e:	e8 a5 16 00 00       	call   c01022c8 <print_trapframe>
    }

    char *buf;
    while (1) {
        if ((buf = readline("K> ")) != NULL) {
c0100c23:	c7 04 24 b9 8e 10 c0 	movl   $0xc0108eb9,(%esp)
c0100c2a:	e8 13 f6 ff ff       	call   c0100242 <readline>
c0100c2f:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0100c32:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0100c36:	74 18                	je     c0100c50 <kmonitor+0x5c>
            if (runcmd(buf, tf) < 0) {
c0100c38:	8b 45 08             	mov    0x8(%ebp),%eax
c0100c3b:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100c3f:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100c42:	89 04 24             	mov    %eax,(%esp)
c0100c45:	e8 f8 fe ff ff       	call   c0100b42 <runcmd>
c0100c4a:	85 c0                	test   %eax,%eax
c0100c4c:	79 02                	jns    c0100c50 <kmonitor+0x5c>
                break;
c0100c4e:	eb 02                	jmp    c0100c52 <kmonitor+0x5e>
            }
        }
    }
c0100c50:	eb d1                	jmp    c0100c23 <kmonitor+0x2f>
}
c0100c52:	c9                   	leave  
c0100c53:	c3                   	ret    

c0100c54 <mon_help>:

/* mon_help - print the information about mon_* functions */
int
mon_help(int argc, char **argv, struct trapframe *tf) {
c0100c54:	55                   	push   %ebp
c0100c55:	89 e5                	mov    %esp,%ebp
c0100c57:	83 ec 28             	sub    $0x28,%esp
    int i;
    for (i = 0; i < NCOMMANDS; i ++) {
c0100c5a:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
c0100c61:	eb 3f                	jmp    c0100ca2 <mon_help+0x4e>
        cprintf("%s - %s\n", commands[i].name, commands[i].desc);
c0100c63:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0100c66:	89 d0                	mov    %edx,%eax
c0100c68:	01 c0                	add    %eax,%eax
c0100c6a:	01 d0                	add    %edx,%eax
c0100c6c:	c1 e0 02             	shl    $0x2,%eax
c0100c6f:	05 20 00 12 c0       	add    $0xc0120020,%eax
c0100c74:	8b 48 04             	mov    0x4(%eax),%ecx
c0100c77:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0100c7a:	89 d0                	mov    %edx,%eax
c0100c7c:	01 c0                	add    %eax,%eax
c0100c7e:	01 d0                	add    %edx,%eax
c0100c80:	c1 e0 02             	shl    $0x2,%eax
c0100c83:	05 20 00 12 c0       	add    $0xc0120020,%eax
c0100c88:	8b 00                	mov    (%eax),%eax
c0100c8a:	89 4c 24 08          	mov    %ecx,0x8(%esp)
c0100c8e:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100c92:	c7 04 24 bd 8e 10 c0 	movl   $0xc0108ebd,(%esp)
c0100c99:	e8 ad f6 ff ff       	call   c010034b <cprintf>

/* mon_help - print the information about mon_* functions */
int
mon_help(int argc, char **argv, struct trapframe *tf) {
    int i;
    for (i = 0; i < NCOMMANDS; i ++) {
c0100c9e:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
c0100ca2:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100ca5:	83 f8 02             	cmp    $0x2,%eax
c0100ca8:	76 b9                	jbe    c0100c63 <mon_help+0xf>
        cprintf("%s - %s\n", commands[i].name, commands[i].desc);
    }
    return 0;
c0100caa:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0100caf:	c9                   	leave  
c0100cb0:	c3                   	ret    

c0100cb1 <mon_kerninfo>:
/* *
 * mon_kerninfo - call print_kerninfo in kern/debug/kdebug.c to
 * print the memory occupancy in kernel.
 * */
int
mon_kerninfo(int argc, char **argv, struct trapframe *tf) {
c0100cb1:	55                   	push   %ebp
c0100cb2:	89 e5                	mov    %esp,%ebp
c0100cb4:	83 ec 08             	sub    $0x8,%esp
    print_kerninfo();
c0100cb7:	e8 c3 fb ff ff       	call   c010087f <print_kerninfo>
    return 0;
c0100cbc:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0100cc1:	c9                   	leave  
c0100cc2:	c3                   	ret    

c0100cc3 <mon_backtrace>:
/* *
 * mon_backtrace - call print_stackframe in kern/debug/kdebug.c to
 * print a backtrace of the stack.
 * */
int
mon_backtrace(int argc, char **argv, struct trapframe *tf) {
c0100cc3:	55                   	push   %ebp
c0100cc4:	89 e5                	mov    %esp,%ebp
c0100cc6:	83 ec 08             	sub    $0x8,%esp
    print_stackframe();
c0100cc9:	e8 fb fc ff ff       	call   c01009c9 <print_stackframe>
    return 0;
c0100cce:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0100cd3:	c9                   	leave  
c0100cd4:	c3                   	ret    

c0100cd5 <__panic>:
/* *
 * __panic - __panic is called on unresolvable fatal errors. it prints
 * "panic: 'message'", and then enters the kernel monitor.
 * */
void
__panic(const char *file, int line, const char *fmt, ...) {
c0100cd5:	55                   	push   %ebp
c0100cd6:	89 e5                	mov    %esp,%ebp
c0100cd8:	83 ec 28             	sub    $0x28,%esp
    if (is_panic) {
c0100cdb:	a1 a0 0e 12 c0       	mov    0xc0120ea0,%eax
c0100ce0:	85 c0                	test   %eax,%eax
c0100ce2:	74 02                	je     c0100ce6 <__panic+0x11>
        goto panic_dead;
c0100ce4:	eb 48                	jmp    c0100d2e <__panic+0x59>
    }
    is_panic = 1;
c0100ce6:	c7 05 a0 0e 12 c0 01 	movl   $0x1,0xc0120ea0
c0100ced:	00 00 00 

    // print the 'message'
    va_list ap;
    va_start(ap, fmt);
c0100cf0:	8d 45 14             	lea    0x14(%ebp),%eax
c0100cf3:	89 45 f4             	mov    %eax,-0xc(%ebp)
    cprintf("kernel panic at %s:%d:\n    ", file, line);
c0100cf6:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100cf9:	89 44 24 08          	mov    %eax,0x8(%esp)
c0100cfd:	8b 45 08             	mov    0x8(%ebp),%eax
c0100d00:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100d04:	c7 04 24 c6 8e 10 c0 	movl   $0xc0108ec6,(%esp)
c0100d0b:	e8 3b f6 ff ff       	call   c010034b <cprintf>
    vcprintf(fmt, ap);
c0100d10:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100d13:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100d17:	8b 45 10             	mov    0x10(%ebp),%eax
c0100d1a:	89 04 24             	mov    %eax,(%esp)
c0100d1d:	e8 f6 f5 ff ff       	call   c0100318 <vcprintf>
    cprintf("\n");
c0100d22:	c7 04 24 e2 8e 10 c0 	movl   $0xc0108ee2,(%esp)
c0100d29:	e8 1d f6 ff ff       	call   c010034b <cprintf>
    va_end(ap);

panic_dead:
    intr_disable();
c0100d2e:	e8 fa 11 00 00       	call   c0101f2d <intr_disable>
    while (1) {
        kmonitor(NULL);
c0100d33:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
c0100d3a:	e8 b5 fe ff ff       	call   c0100bf4 <kmonitor>
    }
c0100d3f:	eb f2                	jmp    c0100d33 <__panic+0x5e>

c0100d41 <__warn>:
}

/* __warn - like panic, but don't */
void
__warn(const char *file, int line, const char *fmt, ...) {
c0100d41:	55                   	push   %ebp
c0100d42:	89 e5                	mov    %esp,%ebp
c0100d44:	83 ec 28             	sub    $0x28,%esp
    va_list ap;
    va_start(ap, fmt);
c0100d47:	8d 45 14             	lea    0x14(%ebp),%eax
c0100d4a:	89 45 f4             	mov    %eax,-0xc(%ebp)
    cprintf("kernel warning at %s:%d:\n    ", file, line);
c0100d4d:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100d50:	89 44 24 08          	mov    %eax,0x8(%esp)
c0100d54:	8b 45 08             	mov    0x8(%ebp),%eax
c0100d57:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100d5b:	c7 04 24 e4 8e 10 c0 	movl   $0xc0108ee4,(%esp)
c0100d62:	e8 e4 f5 ff ff       	call   c010034b <cprintf>
    vcprintf(fmt, ap);
c0100d67:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100d6a:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100d6e:	8b 45 10             	mov    0x10(%ebp),%eax
c0100d71:	89 04 24             	mov    %eax,(%esp)
c0100d74:	e8 9f f5 ff ff       	call   c0100318 <vcprintf>
    cprintf("\n");
c0100d79:	c7 04 24 e2 8e 10 c0 	movl   $0xc0108ee2,(%esp)
c0100d80:	e8 c6 f5 ff ff       	call   c010034b <cprintf>
    va_end(ap);
}
c0100d85:	c9                   	leave  
c0100d86:	c3                   	ret    

c0100d87 <is_kernel_panic>:

bool
is_kernel_panic(void) {
c0100d87:	55                   	push   %ebp
c0100d88:	89 e5                	mov    %esp,%ebp
    return is_panic;
c0100d8a:	a1 a0 0e 12 c0       	mov    0xc0120ea0,%eax
}
c0100d8f:	5d                   	pop    %ebp
c0100d90:	c3                   	ret    

c0100d91 <clock_init>:
/* *
 * clock_init - initialize 8253 clock to interrupt 100 times per second,
 * and then enable IRQ_TIMER.
 * */
void
clock_init(void) {
c0100d91:	55                   	push   %ebp
c0100d92:	89 e5                	mov    %esp,%ebp
c0100d94:	83 ec 28             	sub    $0x28,%esp
c0100d97:	66 c7 45 f6 43 00    	movw   $0x43,-0xa(%ebp)
c0100d9d:	c6 45 f5 34          	movb   $0x34,-0xb(%ebp)
        : "memory", "cc");
}

static inline void
outb(uint16_t port, uint8_t data) {
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0100da1:	0f b6 45 f5          	movzbl -0xb(%ebp),%eax
c0100da5:	0f b7 55 f6          	movzwl -0xa(%ebp),%edx
c0100da9:	ee                   	out    %al,(%dx)
c0100daa:	66 c7 45 f2 40 00    	movw   $0x40,-0xe(%ebp)
c0100db0:	c6 45 f1 9c          	movb   $0x9c,-0xf(%ebp)
c0100db4:	0f b6 45 f1          	movzbl -0xf(%ebp),%eax
c0100db8:	0f b7 55 f2          	movzwl -0xe(%ebp),%edx
c0100dbc:	ee                   	out    %al,(%dx)
c0100dbd:	66 c7 45 ee 40 00    	movw   $0x40,-0x12(%ebp)
c0100dc3:	c6 45 ed 2e          	movb   $0x2e,-0x13(%ebp)
c0100dc7:	0f b6 45 ed          	movzbl -0x13(%ebp),%eax
c0100dcb:	0f b7 55 ee          	movzwl -0x12(%ebp),%edx
c0100dcf:	ee                   	out    %al,(%dx)
    outb(TIMER_MODE, TIMER_SEL0 | TIMER_RATEGEN | TIMER_16BIT);
    outb(IO_TIMER1, TIMER_DIV(100) % 256);
    outb(IO_TIMER1, TIMER_DIV(100) / 256);

    // initialize time counter 'ticks' to zero
    ticks = 0;
c0100dd0:	c7 05 bc 1a 12 c0 00 	movl   $0x0,0xc0121abc
c0100dd7:	00 00 00 

    cprintf("++ setup timer interrupts\n");
c0100dda:	c7 04 24 02 8f 10 c0 	movl   $0xc0108f02,(%esp)
c0100de1:	e8 65 f5 ff ff       	call   c010034b <cprintf>
    pic_enable(IRQ_TIMER);
c0100de6:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
c0100ded:	e8 99 11 00 00       	call   c0101f8b <pic_enable>
}
c0100df2:	c9                   	leave  
c0100df3:	c3                   	ret    

c0100df4 <__intr_save>:
#include <x86.h>
#include <intr.h>
#include <mmu.h>

static inline bool
__intr_save(void) {
c0100df4:	55                   	push   %ebp
c0100df5:	89 e5                	mov    %esp,%ebp
c0100df7:	83 ec 18             	sub    $0x18,%esp
}

static inline uint32_t
read_eflags(void) {
    uint32_t eflags;
    asm volatile ("pushfl; popl %0" : "=r" (eflags));
c0100dfa:	9c                   	pushf  
c0100dfb:	58                   	pop    %eax
c0100dfc:	89 45 f4             	mov    %eax,-0xc(%ebp)
    return eflags;
c0100dff:	8b 45 f4             	mov    -0xc(%ebp),%eax
    if (read_eflags() & FL_IF) {
c0100e02:	25 00 02 00 00       	and    $0x200,%eax
c0100e07:	85 c0                	test   %eax,%eax
c0100e09:	74 0c                	je     c0100e17 <__intr_save+0x23>
        intr_disable();
c0100e0b:	e8 1d 11 00 00       	call   c0101f2d <intr_disable>
        return 1;
c0100e10:	b8 01 00 00 00       	mov    $0x1,%eax
c0100e15:	eb 05                	jmp    c0100e1c <__intr_save+0x28>
    }
    return 0;
c0100e17:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0100e1c:	c9                   	leave  
c0100e1d:	c3                   	ret    

c0100e1e <__intr_restore>:

static inline void
__intr_restore(bool flag) {
c0100e1e:	55                   	push   %ebp
c0100e1f:	89 e5                	mov    %esp,%ebp
c0100e21:	83 ec 08             	sub    $0x8,%esp
    if (flag) {
c0100e24:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
c0100e28:	74 05                	je     c0100e2f <__intr_restore+0x11>
        intr_enable();
c0100e2a:	e8 f8 10 00 00       	call   c0101f27 <intr_enable>
    }
}
c0100e2f:	c9                   	leave  
c0100e30:	c3                   	ret    

c0100e31 <delay>:
#include <memlayout.h>
#include <sync.h>

/* stupid I/O delay routine necessitated by historical PC design flaws */
static void
delay(void) {
c0100e31:	55                   	push   %ebp
c0100e32:	89 e5                	mov    %esp,%ebp
c0100e34:	83 ec 10             	sub    $0x10,%esp
c0100e37:	66 c7 45 fe 84 00    	movw   $0x84,-0x2(%ebp)
static inline void invlpg(void *addr) __attribute__((always_inline));

static inline uint8_t
inb(uint16_t port) {
    uint8_t data;
    asm volatile ("inb %1, %0" : "=a" (data) : "d" (port) : "memory");
c0100e3d:	0f b7 45 fe          	movzwl -0x2(%ebp),%eax
c0100e41:	89 c2                	mov    %eax,%edx
c0100e43:	ec                   	in     (%dx),%al
c0100e44:	88 45 fd             	mov    %al,-0x3(%ebp)
c0100e47:	66 c7 45 fa 84 00    	movw   $0x84,-0x6(%ebp)
c0100e4d:	0f b7 45 fa          	movzwl -0x6(%ebp),%eax
c0100e51:	89 c2                	mov    %eax,%edx
c0100e53:	ec                   	in     (%dx),%al
c0100e54:	88 45 f9             	mov    %al,-0x7(%ebp)
c0100e57:	66 c7 45 f6 84 00    	movw   $0x84,-0xa(%ebp)
c0100e5d:	0f b7 45 f6          	movzwl -0xa(%ebp),%eax
c0100e61:	89 c2                	mov    %eax,%edx
c0100e63:	ec                   	in     (%dx),%al
c0100e64:	88 45 f5             	mov    %al,-0xb(%ebp)
c0100e67:	66 c7 45 f2 84 00    	movw   $0x84,-0xe(%ebp)
c0100e6d:	0f b7 45 f2          	movzwl -0xe(%ebp),%eax
c0100e71:	89 c2                	mov    %eax,%edx
c0100e73:	ec                   	in     (%dx),%al
c0100e74:	88 45 f1             	mov    %al,-0xf(%ebp)
    inb(0x84);
    inb(0x84);
    inb(0x84);
    inb(0x84);
}
c0100e77:	c9                   	leave  
c0100e78:	c3                   	ret    

c0100e79 <cga_init>:
static uint16_t addr_6845;

/* TEXT-mode CGA/VGA display output */

static void
cga_init(void) {
c0100e79:	55                   	push   %ebp
c0100e7a:	89 e5                	mov    %esp,%ebp
c0100e7c:	83 ec 20             	sub    $0x20,%esp
    volatile uint16_t *cp = (uint16_t *)(CGA_BUF + KERNBASE);
c0100e7f:	c7 45 fc 00 80 0b c0 	movl   $0xc00b8000,-0x4(%ebp)
    uint16_t was = *cp;
c0100e86:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0100e89:	0f b7 00             	movzwl (%eax),%eax
c0100e8c:	66 89 45 fa          	mov    %ax,-0x6(%ebp)
    *cp = (uint16_t) 0xA55A;
c0100e90:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0100e93:	66 c7 00 5a a5       	movw   $0xa55a,(%eax)
    if (*cp != 0xA55A) {
c0100e98:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0100e9b:	0f b7 00             	movzwl (%eax),%eax
c0100e9e:	66 3d 5a a5          	cmp    $0xa55a,%ax
c0100ea2:	74 12                	je     c0100eb6 <cga_init+0x3d>
        cp = (uint16_t*)(MONO_BUF + KERNBASE);
c0100ea4:	c7 45 fc 00 00 0b c0 	movl   $0xc00b0000,-0x4(%ebp)
        addr_6845 = MONO_BASE;
c0100eab:	66 c7 05 c6 0e 12 c0 	movw   $0x3b4,0xc0120ec6
c0100eb2:	b4 03 
c0100eb4:	eb 13                	jmp    c0100ec9 <cga_init+0x50>
    } else {
        *cp = was;
c0100eb6:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0100eb9:	0f b7 55 fa          	movzwl -0x6(%ebp),%edx
c0100ebd:	66 89 10             	mov    %dx,(%eax)
        addr_6845 = CGA_BASE;
c0100ec0:	66 c7 05 c6 0e 12 c0 	movw   $0x3d4,0xc0120ec6
c0100ec7:	d4 03 
    }

    // Extract cursor location
    uint32_t pos;
    outb(addr_6845, 14);
c0100ec9:	0f b7 05 c6 0e 12 c0 	movzwl 0xc0120ec6,%eax
c0100ed0:	0f b7 c0             	movzwl %ax,%eax
c0100ed3:	66 89 45 f2          	mov    %ax,-0xe(%ebp)
c0100ed7:	c6 45 f1 0e          	movb   $0xe,-0xf(%ebp)
        : "memory", "cc");
}

static inline void
outb(uint16_t port, uint8_t data) {
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0100edb:	0f b6 45 f1          	movzbl -0xf(%ebp),%eax
c0100edf:	0f b7 55 f2          	movzwl -0xe(%ebp),%edx
c0100ee3:	ee                   	out    %al,(%dx)
    pos = inb(addr_6845 + 1) << 8;
c0100ee4:	0f b7 05 c6 0e 12 c0 	movzwl 0xc0120ec6,%eax
c0100eeb:	83 c0 01             	add    $0x1,%eax
c0100eee:	0f b7 c0             	movzwl %ax,%eax
c0100ef1:	66 89 45 ee          	mov    %ax,-0x12(%ebp)
static inline void invlpg(void *addr) __attribute__((always_inline));

static inline uint8_t
inb(uint16_t port) {
    uint8_t data;
    asm volatile ("inb %1, %0" : "=a" (data) : "d" (port) : "memory");
c0100ef5:	0f b7 45 ee          	movzwl -0x12(%ebp),%eax
c0100ef9:	89 c2                	mov    %eax,%edx
c0100efb:	ec                   	in     (%dx),%al
c0100efc:	88 45 ed             	mov    %al,-0x13(%ebp)
    return data;
c0100eff:	0f b6 45 ed          	movzbl -0x13(%ebp),%eax
c0100f03:	0f b6 c0             	movzbl %al,%eax
c0100f06:	c1 e0 08             	shl    $0x8,%eax
c0100f09:	89 45 f4             	mov    %eax,-0xc(%ebp)
    outb(addr_6845, 15);
c0100f0c:	0f b7 05 c6 0e 12 c0 	movzwl 0xc0120ec6,%eax
c0100f13:	0f b7 c0             	movzwl %ax,%eax
c0100f16:	66 89 45 ea          	mov    %ax,-0x16(%ebp)
c0100f1a:	c6 45 e9 0f          	movb   $0xf,-0x17(%ebp)
        : "memory", "cc");
}

static inline void
outb(uint16_t port, uint8_t data) {
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0100f1e:	0f b6 45 e9          	movzbl -0x17(%ebp),%eax
c0100f22:	0f b7 55 ea          	movzwl -0x16(%ebp),%edx
c0100f26:	ee                   	out    %al,(%dx)
    pos |= inb(addr_6845 + 1);
c0100f27:	0f b7 05 c6 0e 12 c0 	movzwl 0xc0120ec6,%eax
c0100f2e:	83 c0 01             	add    $0x1,%eax
c0100f31:	0f b7 c0             	movzwl %ax,%eax
c0100f34:	66 89 45 e6          	mov    %ax,-0x1a(%ebp)
static inline void invlpg(void *addr) __attribute__((always_inline));

static inline uint8_t
inb(uint16_t port) {
    uint8_t data;
    asm volatile ("inb %1, %0" : "=a" (data) : "d" (port) : "memory");
c0100f38:	0f b7 45 e6          	movzwl -0x1a(%ebp),%eax
c0100f3c:	89 c2                	mov    %eax,%edx
c0100f3e:	ec                   	in     (%dx),%al
c0100f3f:	88 45 e5             	mov    %al,-0x1b(%ebp)
    return data;
c0100f42:	0f b6 45 e5          	movzbl -0x1b(%ebp),%eax
c0100f46:	0f b6 c0             	movzbl %al,%eax
c0100f49:	09 45 f4             	or     %eax,-0xc(%ebp)

    crt_buf = (uint16_t*) cp;
c0100f4c:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0100f4f:	a3 c0 0e 12 c0       	mov    %eax,0xc0120ec0
    crt_pos = pos;
c0100f54:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100f57:	66 a3 c4 0e 12 c0    	mov    %ax,0xc0120ec4
}
c0100f5d:	c9                   	leave  
c0100f5e:	c3                   	ret    

c0100f5f <serial_init>:

static bool serial_exists = 0;

static void
serial_init(void) {
c0100f5f:	55                   	push   %ebp
c0100f60:	89 e5                	mov    %esp,%ebp
c0100f62:	83 ec 48             	sub    $0x48,%esp
c0100f65:	66 c7 45 f6 fa 03    	movw   $0x3fa,-0xa(%ebp)
c0100f6b:	c6 45 f5 00          	movb   $0x0,-0xb(%ebp)
        : "memory", "cc");
}

static inline void
outb(uint16_t port, uint8_t data) {
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0100f6f:	0f b6 45 f5          	movzbl -0xb(%ebp),%eax
c0100f73:	0f b7 55 f6          	movzwl -0xa(%ebp),%edx
c0100f77:	ee                   	out    %al,(%dx)
c0100f78:	66 c7 45 f2 fb 03    	movw   $0x3fb,-0xe(%ebp)
c0100f7e:	c6 45 f1 80          	movb   $0x80,-0xf(%ebp)
c0100f82:	0f b6 45 f1          	movzbl -0xf(%ebp),%eax
c0100f86:	0f b7 55 f2          	movzwl -0xe(%ebp),%edx
c0100f8a:	ee                   	out    %al,(%dx)
c0100f8b:	66 c7 45 ee f8 03    	movw   $0x3f8,-0x12(%ebp)
c0100f91:	c6 45 ed 0c          	movb   $0xc,-0x13(%ebp)
c0100f95:	0f b6 45 ed          	movzbl -0x13(%ebp),%eax
c0100f99:	0f b7 55 ee          	movzwl -0x12(%ebp),%edx
c0100f9d:	ee                   	out    %al,(%dx)
c0100f9e:	66 c7 45 ea f9 03    	movw   $0x3f9,-0x16(%ebp)
c0100fa4:	c6 45 e9 00          	movb   $0x0,-0x17(%ebp)
c0100fa8:	0f b6 45 e9          	movzbl -0x17(%ebp),%eax
c0100fac:	0f b7 55 ea          	movzwl -0x16(%ebp),%edx
c0100fb0:	ee                   	out    %al,(%dx)
c0100fb1:	66 c7 45 e6 fb 03    	movw   $0x3fb,-0x1a(%ebp)
c0100fb7:	c6 45 e5 03          	movb   $0x3,-0x1b(%ebp)
c0100fbb:	0f b6 45 e5          	movzbl -0x1b(%ebp),%eax
c0100fbf:	0f b7 55 e6          	movzwl -0x1a(%ebp),%edx
c0100fc3:	ee                   	out    %al,(%dx)
c0100fc4:	66 c7 45 e2 fc 03    	movw   $0x3fc,-0x1e(%ebp)
c0100fca:	c6 45 e1 00          	movb   $0x0,-0x1f(%ebp)
c0100fce:	0f b6 45 e1          	movzbl -0x1f(%ebp),%eax
c0100fd2:	0f b7 55 e2          	movzwl -0x1e(%ebp),%edx
c0100fd6:	ee                   	out    %al,(%dx)
c0100fd7:	66 c7 45 de f9 03    	movw   $0x3f9,-0x22(%ebp)
c0100fdd:	c6 45 dd 01          	movb   $0x1,-0x23(%ebp)
c0100fe1:	0f b6 45 dd          	movzbl -0x23(%ebp),%eax
c0100fe5:	0f b7 55 de          	movzwl -0x22(%ebp),%edx
c0100fe9:	ee                   	out    %al,(%dx)
c0100fea:	66 c7 45 da fd 03    	movw   $0x3fd,-0x26(%ebp)
static inline void invlpg(void *addr) __attribute__((always_inline));

static inline uint8_t
inb(uint16_t port) {
    uint8_t data;
    asm volatile ("inb %1, %0" : "=a" (data) : "d" (port) : "memory");
c0100ff0:	0f b7 45 da          	movzwl -0x26(%ebp),%eax
c0100ff4:	89 c2                	mov    %eax,%edx
c0100ff6:	ec                   	in     (%dx),%al
c0100ff7:	88 45 d9             	mov    %al,-0x27(%ebp)
    return data;
c0100ffa:	0f b6 45 d9          	movzbl -0x27(%ebp),%eax
    // Enable rcv interrupts
    outb(COM1 + COM_IER, COM_IER_RDI);

    // Clear any preexisting overrun indications and interrupts
    // Serial port doesn't exist if COM_LSR returns 0xFF
    serial_exists = (inb(COM1 + COM_LSR) != 0xFF);
c0100ffe:	3c ff                	cmp    $0xff,%al
c0101000:	0f 95 c0             	setne  %al
c0101003:	0f b6 c0             	movzbl %al,%eax
c0101006:	a3 c8 0e 12 c0       	mov    %eax,0xc0120ec8
c010100b:	66 c7 45 d6 fa 03    	movw   $0x3fa,-0x2a(%ebp)
static inline void invlpg(void *addr) __attribute__((always_inline));

static inline uint8_t
inb(uint16_t port) {
    uint8_t data;
    asm volatile ("inb %1, %0" : "=a" (data) : "d" (port) : "memory");
c0101011:	0f b7 45 d6          	movzwl -0x2a(%ebp),%eax
c0101015:	89 c2                	mov    %eax,%edx
c0101017:	ec                   	in     (%dx),%al
c0101018:	88 45 d5             	mov    %al,-0x2b(%ebp)
c010101b:	66 c7 45 d2 f8 03    	movw   $0x3f8,-0x2e(%ebp)
c0101021:	0f b7 45 d2          	movzwl -0x2e(%ebp),%eax
c0101025:	89 c2                	mov    %eax,%edx
c0101027:	ec                   	in     (%dx),%al
c0101028:	88 45 d1             	mov    %al,-0x2f(%ebp)
    (void) inb(COM1+COM_IIR);
    (void) inb(COM1+COM_RX);

    if (serial_exists) {
c010102b:	a1 c8 0e 12 c0       	mov    0xc0120ec8,%eax
c0101030:	85 c0                	test   %eax,%eax
c0101032:	74 0c                	je     c0101040 <serial_init+0xe1>
        pic_enable(IRQ_COM1);
c0101034:	c7 04 24 04 00 00 00 	movl   $0x4,(%esp)
c010103b:	e8 4b 0f 00 00       	call   c0101f8b <pic_enable>
    }
}
c0101040:	c9                   	leave  
c0101041:	c3                   	ret    

c0101042 <lpt_putc_sub>:

static void
lpt_putc_sub(int c) {
c0101042:	55                   	push   %ebp
c0101043:	89 e5                	mov    %esp,%ebp
c0101045:	83 ec 20             	sub    $0x20,%esp
    int i;
    for (i = 0; !(inb(LPTPORT + 1) & 0x80) && i < 12800; i ++) {
c0101048:	c7 45 fc 00 00 00 00 	movl   $0x0,-0x4(%ebp)
c010104f:	eb 09                	jmp    c010105a <lpt_putc_sub+0x18>
        delay();
c0101051:	e8 db fd ff ff       	call   c0100e31 <delay>
}

static void
lpt_putc_sub(int c) {
    int i;
    for (i = 0; !(inb(LPTPORT + 1) & 0x80) && i < 12800; i ++) {
c0101056:	83 45 fc 01          	addl   $0x1,-0x4(%ebp)
c010105a:	66 c7 45 fa 79 03    	movw   $0x379,-0x6(%ebp)
c0101060:	0f b7 45 fa          	movzwl -0x6(%ebp),%eax
c0101064:	89 c2                	mov    %eax,%edx
c0101066:	ec                   	in     (%dx),%al
c0101067:	88 45 f9             	mov    %al,-0x7(%ebp)
    return data;
c010106a:	0f b6 45 f9          	movzbl -0x7(%ebp),%eax
c010106e:	84 c0                	test   %al,%al
c0101070:	78 09                	js     c010107b <lpt_putc_sub+0x39>
c0101072:	81 7d fc ff 31 00 00 	cmpl   $0x31ff,-0x4(%ebp)
c0101079:	7e d6                	jle    c0101051 <lpt_putc_sub+0xf>
        delay();
    }
    outb(LPTPORT + 0, c);
c010107b:	8b 45 08             	mov    0x8(%ebp),%eax
c010107e:	0f b6 c0             	movzbl %al,%eax
c0101081:	66 c7 45 f6 78 03    	movw   $0x378,-0xa(%ebp)
c0101087:	88 45 f5             	mov    %al,-0xb(%ebp)
        : "memory", "cc");
}

static inline void
outb(uint16_t port, uint8_t data) {
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c010108a:	0f b6 45 f5          	movzbl -0xb(%ebp),%eax
c010108e:	0f b7 55 f6          	movzwl -0xa(%ebp),%edx
c0101092:	ee                   	out    %al,(%dx)
c0101093:	66 c7 45 f2 7a 03    	movw   $0x37a,-0xe(%ebp)
c0101099:	c6 45 f1 0d          	movb   $0xd,-0xf(%ebp)
c010109d:	0f b6 45 f1          	movzbl -0xf(%ebp),%eax
c01010a1:	0f b7 55 f2          	movzwl -0xe(%ebp),%edx
c01010a5:	ee                   	out    %al,(%dx)
c01010a6:	66 c7 45 ee 7a 03    	movw   $0x37a,-0x12(%ebp)
c01010ac:	c6 45 ed 08          	movb   $0x8,-0x13(%ebp)
c01010b0:	0f b6 45 ed          	movzbl -0x13(%ebp),%eax
c01010b4:	0f b7 55 ee          	movzwl -0x12(%ebp),%edx
c01010b8:	ee                   	out    %al,(%dx)
    outb(LPTPORT + 2, 0x08 | 0x04 | 0x01);
    outb(LPTPORT + 2, 0x08);
}
c01010b9:	c9                   	leave  
c01010ba:	c3                   	ret    

c01010bb <lpt_putc>:

/* lpt_putc - copy console output to parallel port */
static void
lpt_putc(int c) {
c01010bb:	55                   	push   %ebp
c01010bc:	89 e5                	mov    %esp,%ebp
c01010be:	83 ec 04             	sub    $0x4,%esp
    if (c != '\b') {
c01010c1:	83 7d 08 08          	cmpl   $0x8,0x8(%ebp)
c01010c5:	74 0d                	je     c01010d4 <lpt_putc+0x19>
        lpt_putc_sub(c);
c01010c7:	8b 45 08             	mov    0x8(%ebp),%eax
c01010ca:	89 04 24             	mov    %eax,(%esp)
c01010cd:	e8 70 ff ff ff       	call   c0101042 <lpt_putc_sub>
c01010d2:	eb 24                	jmp    c01010f8 <lpt_putc+0x3d>
    }
    else {
        lpt_putc_sub('\b');
c01010d4:	c7 04 24 08 00 00 00 	movl   $0x8,(%esp)
c01010db:	e8 62 ff ff ff       	call   c0101042 <lpt_putc_sub>
        lpt_putc_sub(' ');
c01010e0:	c7 04 24 20 00 00 00 	movl   $0x20,(%esp)
c01010e7:	e8 56 ff ff ff       	call   c0101042 <lpt_putc_sub>
        lpt_putc_sub('\b');
c01010ec:	c7 04 24 08 00 00 00 	movl   $0x8,(%esp)
c01010f3:	e8 4a ff ff ff       	call   c0101042 <lpt_putc_sub>
    }
}
c01010f8:	c9                   	leave  
c01010f9:	c3                   	ret    

c01010fa <cga_putc>:

/* cga_putc - print character to console */
static void
cga_putc(int c) {
c01010fa:	55                   	push   %ebp
c01010fb:	89 e5                	mov    %esp,%ebp
c01010fd:	53                   	push   %ebx
c01010fe:	83 ec 34             	sub    $0x34,%esp
    // set black on white
    if (!(c & ~0xFF)) {
c0101101:	8b 45 08             	mov    0x8(%ebp),%eax
c0101104:	b0 00                	mov    $0x0,%al
c0101106:	85 c0                	test   %eax,%eax
c0101108:	75 07                	jne    c0101111 <cga_putc+0x17>
        c |= 0x0700;
c010110a:	81 4d 08 00 07 00 00 	orl    $0x700,0x8(%ebp)
    }

    switch (c & 0xff) {
c0101111:	8b 45 08             	mov    0x8(%ebp),%eax
c0101114:	0f b6 c0             	movzbl %al,%eax
c0101117:	83 f8 0a             	cmp    $0xa,%eax
c010111a:	74 4c                	je     c0101168 <cga_putc+0x6e>
c010111c:	83 f8 0d             	cmp    $0xd,%eax
c010111f:	74 57                	je     c0101178 <cga_putc+0x7e>
c0101121:	83 f8 08             	cmp    $0x8,%eax
c0101124:	0f 85 88 00 00 00    	jne    c01011b2 <cga_putc+0xb8>
    case '\b':
        if (crt_pos > 0) {
c010112a:	0f b7 05 c4 0e 12 c0 	movzwl 0xc0120ec4,%eax
c0101131:	66 85 c0             	test   %ax,%ax
c0101134:	74 30                	je     c0101166 <cga_putc+0x6c>
            crt_pos --;
c0101136:	0f b7 05 c4 0e 12 c0 	movzwl 0xc0120ec4,%eax
c010113d:	83 e8 01             	sub    $0x1,%eax
c0101140:	66 a3 c4 0e 12 c0    	mov    %ax,0xc0120ec4
            crt_buf[crt_pos] = (c & ~0xff) | ' ';
c0101146:	a1 c0 0e 12 c0       	mov    0xc0120ec0,%eax
c010114b:	0f b7 15 c4 0e 12 c0 	movzwl 0xc0120ec4,%edx
c0101152:	0f b7 d2             	movzwl %dx,%edx
c0101155:	01 d2                	add    %edx,%edx
c0101157:	01 c2                	add    %eax,%edx
c0101159:	8b 45 08             	mov    0x8(%ebp),%eax
c010115c:	b0 00                	mov    $0x0,%al
c010115e:	83 c8 20             	or     $0x20,%eax
c0101161:	66 89 02             	mov    %ax,(%edx)
        }
        break;
c0101164:	eb 72                	jmp    c01011d8 <cga_putc+0xde>
c0101166:	eb 70                	jmp    c01011d8 <cga_putc+0xde>
    case '\n':
        crt_pos += CRT_COLS;
c0101168:	0f b7 05 c4 0e 12 c0 	movzwl 0xc0120ec4,%eax
c010116f:	83 c0 50             	add    $0x50,%eax
c0101172:	66 a3 c4 0e 12 c0    	mov    %ax,0xc0120ec4
    case '\r':
        crt_pos -= (crt_pos % CRT_COLS);
c0101178:	0f b7 1d c4 0e 12 c0 	movzwl 0xc0120ec4,%ebx
c010117f:	0f b7 0d c4 0e 12 c0 	movzwl 0xc0120ec4,%ecx
c0101186:	0f b7 c1             	movzwl %cx,%eax
c0101189:	69 c0 cd cc 00 00    	imul   $0xcccd,%eax,%eax
c010118f:	c1 e8 10             	shr    $0x10,%eax
c0101192:	89 c2                	mov    %eax,%edx
c0101194:	66 c1 ea 06          	shr    $0x6,%dx
c0101198:	89 d0                	mov    %edx,%eax
c010119a:	c1 e0 02             	shl    $0x2,%eax
c010119d:	01 d0                	add    %edx,%eax
c010119f:	c1 e0 04             	shl    $0x4,%eax
c01011a2:	29 c1                	sub    %eax,%ecx
c01011a4:	89 ca                	mov    %ecx,%edx
c01011a6:	89 d8                	mov    %ebx,%eax
c01011a8:	29 d0                	sub    %edx,%eax
c01011aa:	66 a3 c4 0e 12 c0    	mov    %ax,0xc0120ec4
        break;
c01011b0:	eb 26                	jmp    c01011d8 <cga_putc+0xde>
    default:
        crt_buf[crt_pos ++] = c;     // write the character
c01011b2:	8b 0d c0 0e 12 c0    	mov    0xc0120ec0,%ecx
c01011b8:	0f b7 05 c4 0e 12 c0 	movzwl 0xc0120ec4,%eax
c01011bf:	8d 50 01             	lea    0x1(%eax),%edx
c01011c2:	66 89 15 c4 0e 12 c0 	mov    %dx,0xc0120ec4
c01011c9:	0f b7 c0             	movzwl %ax,%eax
c01011cc:	01 c0                	add    %eax,%eax
c01011ce:	8d 14 01             	lea    (%ecx,%eax,1),%edx
c01011d1:	8b 45 08             	mov    0x8(%ebp),%eax
c01011d4:	66 89 02             	mov    %ax,(%edx)
        break;
c01011d7:	90                   	nop
    }

    // What is the purpose of this?
    if (crt_pos >= CRT_SIZE) {
c01011d8:	0f b7 05 c4 0e 12 c0 	movzwl 0xc0120ec4,%eax
c01011df:	66 3d cf 07          	cmp    $0x7cf,%ax
c01011e3:	76 5b                	jbe    c0101240 <cga_putc+0x146>
        int i;
        memmove(crt_buf, crt_buf + CRT_COLS, (CRT_SIZE - CRT_COLS) * sizeof(uint16_t));
c01011e5:	a1 c0 0e 12 c0       	mov    0xc0120ec0,%eax
c01011ea:	8d 90 a0 00 00 00    	lea    0xa0(%eax),%edx
c01011f0:	a1 c0 0e 12 c0       	mov    0xc0120ec0,%eax
c01011f5:	c7 44 24 08 00 0f 00 	movl   $0xf00,0x8(%esp)
c01011fc:	00 
c01011fd:	89 54 24 04          	mov    %edx,0x4(%esp)
c0101201:	89 04 24             	mov    %eax,(%esp)
c0101204:	e8 95 78 00 00       	call   c0108a9e <memmove>
        for (i = CRT_SIZE - CRT_COLS; i < CRT_SIZE; i ++) {
c0101209:	c7 45 f4 80 07 00 00 	movl   $0x780,-0xc(%ebp)
c0101210:	eb 15                	jmp    c0101227 <cga_putc+0x12d>
            crt_buf[i] = 0x0700 | ' ';
c0101212:	a1 c0 0e 12 c0       	mov    0xc0120ec0,%eax
c0101217:	8b 55 f4             	mov    -0xc(%ebp),%edx
c010121a:	01 d2                	add    %edx,%edx
c010121c:	01 d0                	add    %edx,%eax
c010121e:	66 c7 00 20 07       	movw   $0x720,(%eax)

    // What is the purpose of this?
    if (crt_pos >= CRT_SIZE) {
        int i;
        memmove(crt_buf, crt_buf + CRT_COLS, (CRT_SIZE - CRT_COLS) * sizeof(uint16_t));
        for (i = CRT_SIZE - CRT_COLS; i < CRT_SIZE; i ++) {
c0101223:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
c0101227:	81 7d f4 cf 07 00 00 	cmpl   $0x7cf,-0xc(%ebp)
c010122e:	7e e2                	jle    c0101212 <cga_putc+0x118>
            crt_buf[i] = 0x0700 | ' ';
        }
        crt_pos -= CRT_COLS;
c0101230:	0f b7 05 c4 0e 12 c0 	movzwl 0xc0120ec4,%eax
c0101237:	83 e8 50             	sub    $0x50,%eax
c010123a:	66 a3 c4 0e 12 c0    	mov    %ax,0xc0120ec4
    }

    // move that little blinky thing
    outb(addr_6845, 14);
c0101240:	0f b7 05 c6 0e 12 c0 	movzwl 0xc0120ec6,%eax
c0101247:	0f b7 c0             	movzwl %ax,%eax
c010124a:	66 89 45 f2          	mov    %ax,-0xe(%ebp)
c010124e:	c6 45 f1 0e          	movb   $0xe,-0xf(%ebp)
c0101252:	0f b6 45 f1          	movzbl -0xf(%ebp),%eax
c0101256:	0f b7 55 f2          	movzwl -0xe(%ebp),%edx
c010125a:	ee                   	out    %al,(%dx)
    outb(addr_6845 + 1, crt_pos >> 8);
c010125b:	0f b7 05 c4 0e 12 c0 	movzwl 0xc0120ec4,%eax
c0101262:	66 c1 e8 08          	shr    $0x8,%ax
c0101266:	0f b6 c0             	movzbl %al,%eax
c0101269:	0f b7 15 c6 0e 12 c0 	movzwl 0xc0120ec6,%edx
c0101270:	83 c2 01             	add    $0x1,%edx
c0101273:	0f b7 d2             	movzwl %dx,%edx
c0101276:	66 89 55 ee          	mov    %dx,-0x12(%ebp)
c010127a:	88 45 ed             	mov    %al,-0x13(%ebp)
c010127d:	0f b6 45 ed          	movzbl -0x13(%ebp),%eax
c0101281:	0f b7 55 ee          	movzwl -0x12(%ebp),%edx
c0101285:	ee                   	out    %al,(%dx)
    outb(addr_6845, 15);
c0101286:	0f b7 05 c6 0e 12 c0 	movzwl 0xc0120ec6,%eax
c010128d:	0f b7 c0             	movzwl %ax,%eax
c0101290:	66 89 45 ea          	mov    %ax,-0x16(%ebp)
c0101294:	c6 45 e9 0f          	movb   $0xf,-0x17(%ebp)
c0101298:	0f b6 45 e9          	movzbl -0x17(%ebp),%eax
c010129c:	0f b7 55 ea          	movzwl -0x16(%ebp),%edx
c01012a0:	ee                   	out    %al,(%dx)
    outb(addr_6845 + 1, crt_pos);
c01012a1:	0f b7 05 c4 0e 12 c0 	movzwl 0xc0120ec4,%eax
c01012a8:	0f b6 c0             	movzbl %al,%eax
c01012ab:	0f b7 15 c6 0e 12 c0 	movzwl 0xc0120ec6,%edx
c01012b2:	83 c2 01             	add    $0x1,%edx
c01012b5:	0f b7 d2             	movzwl %dx,%edx
c01012b8:	66 89 55 e6          	mov    %dx,-0x1a(%ebp)
c01012bc:	88 45 e5             	mov    %al,-0x1b(%ebp)
c01012bf:	0f b6 45 e5          	movzbl -0x1b(%ebp),%eax
c01012c3:	0f b7 55 e6          	movzwl -0x1a(%ebp),%edx
c01012c7:	ee                   	out    %al,(%dx)
}
c01012c8:	83 c4 34             	add    $0x34,%esp
c01012cb:	5b                   	pop    %ebx
c01012cc:	5d                   	pop    %ebp
c01012cd:	c3                   	ret    

c01012ce <serial_putc_sub>:

static void
serial_putc_sub(int c) {
c01012ce:	55                   	push   %ebp
c01012cf:	89 e5                	mov    %esp,%ebp
c01012d1:	83 ec 10             	sub    $0x10,%esp
    int i;
    for (i = 0; !(inb(COM1 + COM_LSR) & COM_LSR_TXRDY) && i < 12800; i ++) {
c01012d4:	c7 45 fc 00 00 00 00 	movl   $0x0,-0x4(%ebp)
c01012db:	eb 09                	jmp    c01012e6 <serial_putc_sub+0x18>
        delay();
c01012dd:	e8 4f fb ff ff       	call   c0100e31 <delay>
}

static void
serial_putc_sub(int c) {
    int i;
    for (i = 0; !(inb(COM1 + COM_LSR) & COM_LSR_TXRDY) && i < 12800; i ++) {
c01012e2:	83 45 fc 01          	addl   $0x1,-0x4(%ebp)
c01012e6:	66 c7 45 fa fd 03    	movw   $0x3fd,-0x6(%ebp)
static inline void invlpg(void *addr) __attribute__((always_inline));

static inline uint8_t
inb(uint16_t port) {
    uint8_t data;
    asm volatile ("inb %1, %0" : "=a" (data) : "d" (port) : "memory");
c01012ec:	0f b7 45 fa          	movzwl -0x6(%ebp),%eax
c01012f0:	89 c2                	mov    %eax,%edx
c01012f2:	ec                   	in     (%dx),%al
c01012f3:	88 45 f9             	mov    %al,-0x7(%ebp)
    return data;
c01012f6:	0f b6 45 f9          	movzbl -0x7(%ebp),%eax
c01012fa:	0f b6 c0             	movzbl %al,%eax
c01012fd:	83 e0 20             	and    $0x20,%eax
c0101300:	85 c0                	test   %eax,%eax
c0101302:	75 09                	jne    c010130d <serial_putc_sub+0x3f>
c0101304:	81 7d fc ff 31 00 00 	cmpl   $0x31ff,-0x4(%ebp)
c010130b:	7e d0                	jle    c01012dd <serial_putc_sub+0xf>
        delay();
    }
    outb(COM1 + COM_TX, c);
c010130d:	8b 45 08             	mov    0x8(%ebp),%eax
c0101310:	0f b6 c0             	movzbl %al,%eax
c0101313:	66 c7 45 f6 f8 03    	movw   $0x3f8,-0xa(%ebp)
c0101319:	88 45 f5             	mov    %al,-0xb(%ebp)
        : "memory", "cc");
}

static inline void
outb(uint16_t port, uint8_t data) {
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c010131c:	0f b6 45 f5          	movzbl -0xb(%ebp),%eax
c0101320:	0f b7 55 f6          	movzwl -0xa(%ebp),%edx
c0101324:	ee                   	out    %al,(%dx)
}
c0101325:	c9                   	leave  
c0101326:	c3                   	ret    

c0101327 <serial_putc>:

/* serial_putc - print character to serial port */
static void
serial_putc(int c) {
c0101327:	55                   	push   %ebp
c0101328:	89 e5                	mov    %esp,%ebp
c010132a:	83 ec 04             	sub    $0x4,%esp
    if (c != '\b') {
c010132d:	83 7d 08 08          	cmpl   $0x8,0x8(%ebp)
c0101331:	74 0d                	je     c0101340 <serial_putc+0x19>
        serial_putc_sub(c);
c0101333:	8b 45 08             	mov    0x8(%ebp),%eax
c0101336:	89 04 24             	mov    %eax,(%esp)
c0101339:	e8 90 ff ff ff       	call   c01012ce <serial_putc_sub>
c010133e:	eb 24                	jmp    c0101364 <serial_putc+0x3d>
    }
    else {
        serial_putc_sub('\b');
c0101340:	c7 04 24 08 00 00 00 	movl   $0x8,(%esp)
c0101347:	e8 82 ff ff ff       	call   c01012ce <serial_putc_sub>
        serial_putc_sub(' ');
c010134c:	c7 04 24 20 00 00 00 	movl   $0x20,(%esp)
c0101353:	e8 76 ff ff ff       	call   c01012ce <serial_putc_sub>
        serial_putc_sub('\b');
c0101358:	c7 04 24 08 00 00 00 	movl   $0x8,(%esp)
c010135f:	e8 6a ff ff ff       	call   c01012ce <serial_putc_sub>
    }
}
c0101364:	c9                   	leave  
c0101365:	c3                   	ret    

c0101366 <cons_intr>:
/* *
 * cons_intr - called by device interrupt routines to feed input
 * characters into the circular console input buffer.
 * */
static void
cons_intr(int (*proc)(void)) {
c0101366:	55                   	push   %ebp
c0101367:	89 e5                	mov    %esp,%ebp
c0101369:	83 ec 18             	sub    $0x18,%esp
    int c;
    while ((c = (*proc)()) != -1) {
c010136c:	eb 33                	jmp    c01013a1 <cons_intr+0x3b>
        if (c != 0) {
c010136e:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0101372:	74 2d                	je     c01013a1 <cons_intr+0x3b>
            cons.buf[cons.wpos ++] = c;
c0101374:	a1 e4 10 12 c0       	mov    0xc01210e4,%eax
c0101379:	8d 50 01             	lea    0x1(%eax),%edx
c010137c:	89 15 e4 10 12 c0    	mov    %edx,0xc01210e4
c0101382:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0101385:	88 90 e0 0e 12 c0    	mov    %dl,-0x3fedf120(%eax)
            if (cons.wpos == CONSBUFSIZE) {
c010138b:	a1 e4 10 12 c0       	mov    0xc01210e4,%eax
c0101390:	3d 00 02 00 00       	cmp    $0x200,%eax
c0101395:	75 0a                	jne    c01013a1 <cons_intr+0x3b>
                cons.wpos = 0;
c0101397:	c7 05 e4 10 12 c0 00 	movl   $0x0,0xc01210e4
c010139e:	00 00 00 
 * characters into the circular console input buffer.
 * */
static void
cons_intr(int (*proc)(void)) {
    int c;
    while ((c = (*proc)()) != -1) {
c01013a1:	8b 45 08             	mov    0x8(%ebp),%eax
c01013a4:	ff d0                	call   *%eax
c01013a6:	89 45 f4             	mov    %eax,-0xc(%ebp)
c01013a9:	83 7d f4 ff          	cmpl   $0xffffffff,-0xc(%ebp)
c01013ad:	75 bf                	jne    c010136e <cons_intr+0x8>
            if (cons.wpos == CONSBUFSIZE) {
                cons.wpos = 0;
            }
        }
    }
}
c01013af:	c9                   	leave  
c01013b0:	c3                   	ret    

c01013b1 <serial_proc_data>:

/* serial_proc_data - get data from serial port */
static int
serial_proc_data(void) {
c01013b1:	55                   	push   %ebp
c01013b2:	89 e5                	mov    %esp,%ebp
c01013b4:	83 ec 10             	sub    $0x10,%esp
c01013b7:	66 c7 45 fa fd 03    	movw   $0x3fd,-0x6(%ebp)
static inline void invlpg(void *addr) __attribute__((always_inline));

static inline uint8_t
inb(uint16_t port) {
    uint8_t data;
    asm volatile ("inb %1, %0" : "=a" (data) : "d" (port) : "memory");
c01013bd:	0f b7 45 fa          	movzwl -0x6(%ebp),%eax
c01013c1:	89 c2                	mov    %eax,%edx
c01013c3:	ec                   	in     (%dx),%al
c01013c4:	88 45 f9             	mov    %al,-0x7(%ebp)
    return data;
c01013c7:	0f b6 45 f9          	movzbl -0x7(%ebp),%eax
    if (!(inb(COM1 + COM_LSR) & COM_LSR_DATA)) {
c01013cb:	0f b6 c0             	movzbl %al,%eax
c01013ce:	83 e0 01             	and    $0x1,%eax
c01013d1:	85 c0                	test   %eax,%eax
c01013d3:	75 07                	jne    c01013dc <serial_proc_data+0x2b>
        return -1;
c01013d5:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
c01013da:	eb 2a                	jmp    c0101406 <serial_proc_data+0x55>
c01013dc:	66 c7 45 f6 f8 03    	movw   $0x3f8,-0xa(%ebp)
static inline void invlpg(void *addr) __attribute__((always_inline));

static inline uint8_t
inb(uint16_t port) {
    uint8_t data;
    asm volatile ("inb %1, %0" : "=a" (data) : "d" (port) : "memory");
c01013e2:	0f b7 45 f6          	movzwl -0xa(%ebp),%eax
c01013e6:	89 c2                	mov    %eax,%edx
c01013e8:	ec                   	in     (%dx),%al
c01013e9:	88 45 f5             	mov    %al,-0xb(%ebp)
    return data;
c01013ec:	0f b6 45 f5          	movzbl -0xb(%ebp),%eax
    }
    int c = inb(COM1 + COM_RX);
c01013f0:	0f b6 c0             	movzbl %al,%eax
c01013f3:	89 45 fc             	mov    %eax,-0x4(%ebp)
    if (c == 127) {
c01013f6:	83 7d fc 7f          	cmpl   $0x7f,-0x4(%ebp)
c01013fa:	75 07                	jne    c0101403 <serial_proc_data+0x52>
        c = '\b';
c01013fc:	c7 45 fc 08 00 00 00 	movl   $0x8,-0x4(%ebp)
    }
    return c;
c0101403:	8b 45 fc             	mov    -0x4(%ebp),%eax
}
c0101406:	c9                   	leave  
c0101407:	c3                   	ret    

c0101408 <serial_intr>:

/* serial_intr - try to feed input characters from serial port */
void
serial_intr(void) {
c0101408:	55                   	push   %ebp
c0101409:	89 e5                	mov    %esp,%ebp
c010140b:	83 ec 18             	sub    $0x18,%esp
    if (serial_exists) {
c010140e:	a1 c8 0e 12 c0       	mov    0xc0120ec8,%eax
c0101413:	85 c0                	test   %eax,%eax
c0101415:	74 0c                	je     c0101423 <serial_intr+0x1b>
        cons_intr(serial_proc_data);
c0101417:	c7 04 24 b1 13 10 c0 	movl   $0xc01013b1,(%esp)
c010141e:	e8 43 ff ff ff       	call   c0101366 <cons_intr>
    }
}
c0101423:	c9                   	leave  
c0101424:	c3                   	ret    

c0101425 <kbd_proc_data>:
 *
 * The kbd_proc_data() function gets data from the keyboard.
 * If we finish a character, return it, else 0. And return -1 if no data.
 * */
static int
kbd_proc_data(void) {
c0101425:	55                   	push   %ebp
c0101426:	89 e5                	mov    %esp,%ebp
c0101428:	83 ec 38             	sub    $0x38,%esp
c010142b:	66 c7 45 f0 64 00    	movw   $0x64,-0x10(%ebp)
static inline void invlpg(void *addr) __attribute__((always_inline));

static inline uint8_t
inb(uint16_t port) {
    uint8_t data;
    asm volatile ("inb %1, %0" : "=a" (data) : "d" (port) : "memory");
c0101431:	0f b7 45 f0          	movzwl -0x10(%ebp),%eax
c0101435:	89 c2                	mov    %eax,%edx
c0101437:	ec                   	in     (%dx),%al
c0101438:	88 45 ef             	mov    %al,-0x11(%ebp)
    return data;
c010143b:	0f b6 45 ef          	movzbl -0x11(%ebp),%eax
    int c;
    uint8_t data;
    static uint32_t shift;

    if ((inb(KBSTATP) & KBS_DIB) == 0) {
c010143f:	0f b6 c0             	movzbl %al,%eax
c0101442:	83 e0 01             	and    $0x1,%eax
c0101445:	85 c0                	test   %eax,%eax
c0101447:	75 0a                	jne    c0101453 <kbd_proc_data+0x2e>
        return -1;
c0101449:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
c010144e:	e9 59 01 00 00       	jmp    c01015ac <kbd_proc_data+0x187>
c0101453:	66 c7 45 ec 60 00    	movw   $0x60,-0x14(%ebp)
static inline void invlpg(void *addr) __attribute__((always_inline));

static inline uint8_t
inb(uint16_t port) {
    uint8_t data;
    asm volatile ("inb %1, %0" : "=a" (data) : "d" (port) : "memory");
c0101459:	0f b7 45 ec          	movzwl -0x14(%ebp),%eax
c010145d:	89 c2                	mov    %eax,%edx
c010145f:	ec                   	in     (%dx),%al
c0101460:	88 45 eb             	mov    %al,-0x15(%ebp)
    return data;
c0101463:	0f b6 45 eb          	movzbl -0x15(%ebp),%eax
    }

    data = inb(KBDATAP);
c0101467:	88 45 f3             	mov    %al,-0xd(%ebp)

    if (data == 0xE0) {
c010146a:	80 7d f3 e0          	cmpb   $0xe0,-0xd(%ebp)
c010146e:	75 17                	jne    c0101487 <kbd_proc_data+0x62>
        // E0 escape character
        shift |= E0ESC;
c0101470:	a1 e8 10 12 c0       	mov    0xc01210e8,%eax
c0101475:	83 c8 40             	or     $0x40,%eax
c0101478:	a3 e8 10 12 c0       	mov    %eax,0xc01210e8
        return 0;
c010147d:	b8 00 00 00 00       	mov    $0x0,%eax
c0101482:	e9 25 01 00 00       	jmp    c01015ac <kbd_proc_data+0x187>
    } else if (data & 0x80) {
c0101487:	0f b6 45 f3          	movzbl -0xd(%ebp),%eax
c010148b:	84 c0                	test   %al,%al
c010148d:	79 47                	jns    c01014d6 <kbd_proc_data+0xb1>
        // Key released
        data = (shift & E0ESC ? data : data & 0x7F);
c010148f:	a1 e8 10 12 c0       	mov    0xc01210e8,%eax
c0101494:	83 e0 40             	and    $0x40,%eax
c0101497:	85 c0                	test   %eax,%eax
c0101499:	75 09                	jne    c01014a4 <kbd_proc_data+0x7f>
c010149b:	0f b6 45 f3          	movzbl -0xd(%ebp),%eax
c010149f:	83 e0 7f             	and    $0x7f,%eax
c01014a2:	eb 04                	jmp    c01014a8 <kbd_proc_data+0x83>
c01014a4:	0f b6 45 f3          	movzbl -0xd(%ebp),%eax
c01014a8:	88 45 f3             	mov    %al,-0xd(%ebp)
        shift &= ~(shiftcode[data] | E0ESC);
c01014ab:	0f b6 45 f3          	movzbl -0xd(%ebp),%eax
c01014af:	0f b6 80 60 00 12 c0 	movzbl -0x3fedffa0(%eax),%eax
c01014b6:	83 c8 40             	or     $0x40,%eax
c01014b9:	0f b6 c0             	movzbl %al,%eax
c01014bc:	f7 d0                	not    %eax
c01014be:	89 c2                	mov    %eax,%edx
c01014c0:	a1 e8 10 12 c0       	mov    0xc01210e8,%eax
c01014c5:	21 d0                	and    %edx,%eax
c01014c7:	a3 e8 10 12 c0       	mov    %eax,0xc01210e8
        return 0;
c01014cc:	b8 00 00 00 00       	mov    $0x0,%eax
c01014d1:	e9 d6 00 00 00       	jmp    c01015ac <kbd_proc_data+0x187>
    } else if (shift & E0ESC) {
c01014d6:	a1 e8 10 12 c0       	mov    0xc01210e8,%eax
c01014db:	83 e0 40             	and    $0x40,%eax
c01014de:	85 c0                	test   %eax,%eax
c01014e0:	74 11                	je     c01014f3 <kbd_proc_data+0xce>
        // Last character was an E0 escape; or with 0x80
        data |= 0x80;
c01014e2:	80 4d f3 80          	orb    $0x80,-0xd(%ebp)
        shift &= ~E0ESC;
c01014e6:	a1 e8 10 12 c0       	mov    0xc01210e8,%eax
c01014eb:	83 e0 bf             	and    $0xffffffbf,%eax
c01014ee:	a3 e8 10 12 c0       	mov    %eax,0xc01210e8
    }

    shift |= shiftcode[data];
c01014f3:	0f b6 45 f3          	movzbl -0xd(%ebp),%eax
c01014f7:	0f b6 80 60 00 12 c0 	movzbl -0x3fedffa0(%eax),%eax
c01014fe:	0f b6 d0             	movzbl %al,%edx
c0101501:	a1 e8 10 12 c0       	mov    0xc01210e8,%eax
c0101506:	09 d0                	or     %edx,%eax
c0101508:	a3 e8 10 12 c0       	mov    %eax,0xc01210e8
    shift ^= togglecode[data];
c010150d:	0f b6 45 f3          	movzbl -0xd(%ebp),%eax
c0101511:	0f b6 80 60 01 12 c0 	movzbl -0x3fedfea0(%eax),%eax
c0101518:	0f b6 d0             	movzbl %al,%edx
c010151b:	a1 e8 10 12 c0       	mov    0xc01210e8,%eax
c0101520:	31 d0                	xor    %edx,%eax
c0101522:	a3 e8 10 12 c0       	mov    %eax,0xc01210e8

    c = charcode[shift & (CTL | SHIFT)][data];
c0101527:	a1 e8 10 12 c0       	mov    0xc01210e8,%eax
c010152c:	83 e0 03             	and    $0x3,%eax
c010152f:	8b 14 85 60 05 12 c0 	mov    -0x3fedfaa0(,%eax,4),%edx
c0101536:	0f b6 45 f3          	movzbl -0xd(%ebp),%eax
c010153a:	01 d0                	add    %edx,%eax
c010153c:	0f b6 00             	movzbl (%eax),%eax
c010153f:	0f b6 c0             	movzbl %al,%eax
c0101542:	89 45 f4             	mov    %eax,-0xc(%ebp)
    if (shift & CAPSLOCK) {
c0101545:	a1 e8 10 12 c0       	mov    0xc01210e8,%eax
c010154a:	83 e0 08             	and    $0x8,%eax
c010154d:	85 c0                	test   %eax,%eax
c010154f:	74 22                	je     c0101573 <kbd_proc_data+0x14e>
        if ('a' <= c && c <= 'z')
c0101551:	83 7d f4 60          	cmpl   $0x60,-0xc(%ebp)
c0101555:	7e 0c                	jle    c0101563 <kbd_proc_data+0x13e>
c0101557:	83 7d f4 7a          	cmpl   $0x7a,-0xc(%ebp)
c010155b:	7f 06                	jg     c0101563 <kbd_proc_data+0x13e>
            c += 'A' - 'a';
c010155d:	83 6d f4 20          	subl   $0x20,-0xc(%ebp)
c0101561:	eb 10                	jmp    c0101573 <kbd_proc_data+0x14e>
        else if ('A' <= c && c <= 'Z')
c0101563:	83 7d f4 40          	cmpl   $0x40,-0xc(%ebp)
c0101567:	7e 0a                	jle    c0101573 <kbd_proc_data+0x14e>
c0101569:	83 7d f4 5a          	cmpl   $0x5a,-0xc(%ebp)
c010156d:	7f 04                	jg     c0101573 <kbd_proc_data+0x14e>
            c += 'a' - 'A';
c010156f:	83 45 f4 20          	addl   $0x20,-0xc(%ebp)
    }

    // Process special keys
    // Ctrl-Alt-Del: reboot
    if (!(~shift & (CTL | ALT)) && c == KEY_DEL) {
c0101573:	a1 e8 10 12 c0       	mov    0xc01210e8,%eax
c0101578:	f7 d0                	not    %eax
c010157a:	83 e0 06             	and    $0x6,%eax
c010157d:	85 c0                	test   %eax,%eax
c010157f:	75 28                	jne    c01015a9 <kbd_proc_data+0x184>
c0101581:	81 7d f4 e9 00 00 00 	cmpl   $0xe9,-0xc(%ebp)
c0101588:	75 1f                	jne    c01015a9 <kbd_proc_data+0x184>
        cprintf("Rebooting!\n");
c010158a:	c7 04 24 1d 8f 10 c0 	movl   $0xc0108f1d,(%esp)
c0101591:	e8 b5 ed ff ff       	call   c010034b <cprintf>
c0101596:	66 c7 45 e8 92 00    	movw   $0x92,-0x18(%ebp)
c010159c:	c6 45 e7 03          	movb   $0x3,-0x19(%ebp)
        : "memory", "cc");
}

static inline void
outb(uint16_t port, uint8_t data) {
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c01015a0:	0f b6 45 e7          	movzbl -0x19(%ebp),%eax
c01015a4:	0f b7 55 e8          	movzwl -0x18(%ebp),%edx
c01015a8:	ee                   	out    %al,(%dx)
        outb(0x92, 0x3); // courtesy of Chris Frost
    }
    return c;
c01015a9:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c01015ac:	c9                   	leave  
c01015ad:	c3                   	ret    

c01015ae <kbd_intr>:

/* kbd_intr - try to feed input characters from keyboard */
static void
kbd_intr(void) {
c01015ae:	55                   	push   %ebp
c01015af:	89 e5                	mov    %esp,%ebp
c01015b1:	83 ec 18             	sub    $0x18,%esp
    cons_intr(kbd_proc_data);
c01015b4:	c7 04 24 25 14 10 c0 	movl   $0xc0101425,(%esp)
c01015bb:	e8 a6 fd ff ff       	call   c0101366 <cons_intr>
}
c01015c0:	c9                   	leave  
c01015c1:	c3                   	ret    

c01015c2 <kbd_init>:

static void
kbd_init(void) {
c01015c2:	55                   	push   %ebp
c01015c3:	89 e5                	mov    %esp,%ebp
c01015c5:	83 ec 18             	sub    $0x18,%esp
    // drain the kbd buffer
    kbd_intr();
c01015c8:	e8 e1 ff ff ff       	call   c01015ae <kbd_intr>
    pic_enable(IRQ_KBD);
c01015cd:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c01015d4:	e8 b2 09 00 00       	call   c0101f8b <pic_enable>
}
c01015d9:	c9                   	leave  
c01015da:	c3                   	ret    

c01015db <cons_init>:

/* cons_init - initializes the console devices */
void
cons_init(void) {
c01015db:	55                   	push   %ebp
c01015dc:	89 e5                	mov    %esp,%ebp
c01015de:	83 ec 18             	sub    $0x18,%esp
    cga_init();
c01015e1:	e8 93 f8 ff ff       	call   c0100e79 <cga_init>
    serial_init();
c01015e6:	e8 74 f9 ff ff       	call   c0100f5f <serial_init>
    kbd_init();
c01015eb:	e8 d2 ff ff ff       	call   c01015c2 <kbd_init>
    if (!serial_exists) {
c01015f0:	a1 c8 0e 12 c0       	mov    0xc0120ec8,%eax
c01015f5:	85 c0                	test   %eax,%eax
c01015f7:	75 0c                	jne    c0101605 <cons_init+0x2a>
        cprintf("serial port does not exist!!\n");
c01015f9:	c7 04 24 29 8f 10 c0 	movl   $0xc0108f29,(%esp)
c0101600:	e8 46 ed ff ff       	call   c010034b <cprintf>
    }
}
c0101605:	c9                   	leave  
c0101606:	c3                   	ret    

c0101607 <cons_putc>:

/* cons_putc - print a single character @c to console devices */
void
cons_putc(int c) {
c0101607:	55                   	push   %ebp
c0101608:	89 e5                	mov    %esp,%ebp
c010160a:	83 ec 28             	sub    $0x28,%esp
    bool intr_flag;
    local_intr_save(intr_flag);
c010160d:	e8 e2 f7 ff ff       	call   c0100df4 <__intr_save>
c0101612:	89 45 f4             	mov    %eax,-0xc(%ebp)
    {
        lpt_putc(c);
c0101615:	8b 45 08             	mov    0x8(%ebp),%eax
c0101618:	89 04 24             	mov    %eax,(%esp)
c010161b:	e8 9b fa ff ff       	call   c01010bb <lpt_putc>
        cga_putc(c);
c0101620:	8b 45 08             	mov    0x8(%ebp),%eax
c0101623:	89 04 24             	mov    %eax,(%esp)
c0101626:	e8 cf fa ff ff       	call   c01010fa <cga_putc>
        serial_putc(c);
c010162b:	8b 45 08             	mov    0x8(%ebp),%eax
c010162e:	89 04 24             	mov    %eax,(%esp)
c0101631:	e8 f1 fc ff ff       	call   c0101327 <serial_putc>
    }
    local_intr_restore(intr_flag);
c0101636:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0101639:	89 04 24             	mov    %eax,(%esp)
c010163c:	e8 dd f7 ff ff       	call   c0100e1e <__intr_restore>
}
c0101641:	c9                   	leave  
c0101642:	c3                   	ret    

c0101643 <cons_getc>:
/* *
 * cons_getc - return the next input character from console,
 * or 0 if none waiting.
 * */
int
cons_getc(void) {
c0101643:	55                   	push   %ebp
c0101644:	89 e5                	mov    %esp,%ebp
c0101646:	83 ec 28             	sub    $0x28,%esp
    int c = 0;
c0101649:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
    bool intr_flag;
    local_intr_save(intr_flag);
c0101650:	e8 9f f7 ff ff       	call   c0100df4 <__intr_save>
c0101655:	89 45 f0             	mov    %eax,-0x10(%ebp)
    {
        // poll for any pending input characters,
        // so that this function works even when interrupts are disabled
        // (e.g., when called from the kernel monitor).
        serial_intr();
c0101658:	e8 ab fd ff ff       	call   c0101408 <serial_intr>
        kbd_intr();
c010165d:	e8 4c ff ff ff       	call   c01015ae <kbd_intr>

        // grab the next character from the input buffer.
        if (cons.rpos != cons.wpos) {
c0101662:	8b 15 e0 10 12 c0    	mov    0xc01210e0,%edx
c0101668:	a1 e4 10 12 c0       	mov    0xc01210e4,%eax
c010166d:	39 c2                	cmp    %eax,%edx
c010166f:	74 31                	je     c01016a2 <cons_getc+0x5f>
            c = cons.buf[cons.rpos ++];
c0101671:	a1 e0 10 12 c0       	mov    0xc01210e0,%eax
c0101676:	8d 50 01             	lea    0x1(%eax),%edx
c0101679:	89 15 e0 10 12 c0    	mov    %edx,0xc01210e0
c010167f:	0f b6 80 e0 0e 12 c0 	movzbl -0x3fedf120(%eax),%eax
c0101686:	0f b6 c0             	movzbl %al,%eax
c0101689:	89 45 f4             	mov    %eax,-0xc(%ebp)
            if (cons.rpos == CONSBUFSIZE) {
c010168c:	a1 e0 10 12 c0       	mov    0xc01210e0,%eax
c0101691:	3d 00 02 00 00       	cmp    $0x200,%eax
c0101696:	75 0a                	jne    c01016a2 <cons_getc+0x5f>
                cons.rpos = 0;
c0101698:	c7 05 e0 10 12 c0 00 	movl   $0x0,0xc01210e0
c010169f:	00 00 00 
            }
        }
    }
    local_intr_restore(intr_flag);
c01016a2:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01016a5:	89 04 24             	mov    %eax,(%esp)
c01016a8:	e8 71 f7 ff ff       	call   c0100e1e <__intr_restore>
    return c;
c01016ad:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c01016b0:	c9                   	leave  
c01016b1:	c3                   	ret    

c01016b2 <ide_wait_ready>:
    unsigned int size;          // Size in Sectors
    unsigned char model[41];    // Model in String
} ide_devices[MAX_IDE];

static int
ide_wait_ready(unsigned short iobase, bool check_error) {
c01016b2:	55                   	push   %ebp
c01016b3:	89 e5                	mov    %esp,%ebp
c01016b5:	83 ec 14             	sub    $0x14,%esp
c01016b8:	8b 45 08             	mov    0x8(%ebp),%eax
c01016bb:	66 89 45 ec          	mov    %ax,-0x14(%ebp)
    int r;
    while ((r = inb(iobase + ISA_STATUS)) & IDE_BSY)
c01016bf:	90                   	nop
c01016c0:	0f b7 45 ec          	movzwl -0x14(%ebp),%eax
c01016c4:	83 c0 07             	add    $0x7,%eax
c01016c7:	0f b7 c0             	movzwl %ax,%eax
c01016ca:	66 89 45 fa          	mov    %ax,-0x6(%ebp)
static inline void invlpg(void *addr) __attribute__((always_inline));

static inline uint8_t
inb(uint16_t port) {
    uint8_t data;
    asm volatile ("inb %1, %0" : "=a" (data) : "d" (port) : "memory");
c01016ce:	0f b7 45 fa          	movzwl -0x6(%ebp),%eax
c01016d2:	89 c2                	mov    %eax,%edx
c01016d4:	ec                   	in     (%dx),%al
c01016d5:	88 45 f9             	mov    %al,-0x7(%ebp)
    return data;
c01016d8:	0f b6 45 f9          	movzbl -0x7(%ebp),%eax
c01016dc:	0f b6 c0             	movzbl %al,%eax
c01016df:	89 45 fc             	mov    %eax,-0x4(%ebp)
c01016e2:	8b 45 fc             	mov    -0x4(%ebp),%eax
c01016e5:	25 80 00 00 00       	and    $0x80,%eax
c01016ea:	85 c0                	test   %eax,%eax
c01016ec:	75 d2                	jne    c01016c0 <ide_wait_ready+0xe>
        /* nothing */;
    if (check_error && (r & (IDE_DF | IDE_ERR)) != 0) {
c01016ee:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
c01016f2:	74 11                	je     c0101705 <ide_wait_ready+0x53>
c01016f4:	8b 45 fc             	mov    -0x4(%ebp),%eax
c01016f7:	83 e0 21             	and    $0x21,%eax
c01016fa:	85 c0                	test   %eax,%eax
c01016fc:	74 07                	je     c0101705 <ide_wait_ready+0x53>
        return -1;
c01016fe:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
c0101703:	eb 05                	jmp    c010170a <ide_wait_ready+0x58>
    }
    return 0;
c0101705:	b8 00 00 00 00       	mov    $0x0,%eax
}
c010170a:	c9                   	leave  
c010170b:	c3                   	ret    

c010170c <ide_init>:

void
ide_init(void) {
c010170c:	55                   	push   %ebp
c010170d:	89 e5                	mov    %esp,%ebp
c010170f:	57                   	push   %edi
c0101710:	53                   	push   %ebx
c0101711:	81 ec 50 02 00 00    	sub    $0x250,%esp
    static_assert((SECTSIZE % 4) == 0);
    unsigned short ideno, iobase;
    for (ideno = 0; ideno < MAX_IDE; ideno ++) {
c0101717:	66 c7 45 f6 00 00    	movw   $0x0,-0xa(%ebp)
c010171d:	e9 d6 02 00 00       	jmp    c01019f8 <ide_init+0x2ec>
        /* assume that no device here */
        ide_devices[ideno].valid = 0;
c0101722:	0f b7 45 f6          	movzwl -0xa(%ebp),%eax
c0101726:	c1 e0 03             	shl    $0x3,%eax
c0101729:	8d 14 c5 00 00 00 00 	lea    0x0(,%eax,8),%edx
c0101730:	29 c2                	sub    %eax,%edx
c0101732:	8d 82 00 11 12 c0    	lea    -0x3fedef00(%edx),%eax
c0101738:	c6 00 00             	movb   $0x0,(%eax)

        iobase = IO_BASE(ideno);
c010173b:	0f b7 45 f6          	movzwl -0xa(%ebp),%eax
c010173f:	66 d1 e8             	shr    %ax
c0101742:	0f b7 c0             	movzwl %ax,%eax
c0101745:	0f b7 04 85 48 8f 10 	movzwl -0x3fef70b8(,%eax,4),%eax
c010174c:	c0 
c010174d:	66 89 45 ea          	mov    %ax,-0x16(%ebp)

        /* wait device ready */
        ide_wait_ready(iobase, 0);
c0101751:	0f b7 45 ea          	movzwl -0x16(%ebp),%eax
c0101755:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c010175c:	00 
c010175d:	89 04 24             	mov    %eax,(%esp)
c0101760:	e8 4d ff ff ff       	call   c01016b2 <ide_wait_ready>

        /* step1: select drive */
        outb(iobase + ISA_SDH, 0xE0 | ((ideno & 1) << 4));
c0101765:	0f b7 45 f6          	movzwl -0xa(%ebp),%eax
c0101769:	83 e0 01             	and    $0x1,%eax
c010176c:	c1 e0 04             	shl    $0x4,%eax
c010176f:	83 c8 e0             	or     $0xffffffe0,%eax
c0101772:	0f b6 c0             	movzbl %al,%eax
c0101775:	0f b7 55 ea          	movzwl -0x16(%ebp),%edx
c0101779:	83 c2 06             	add    $0x6,%edx
c010177c:	0f b7 d2             	movzwl %dx,%edx
c010177f:	66 89 55 d2          	mov    %dx,-0x2e(%ebp)
c0101783:	88 45 d1             	mov    %al,-0x2f(%ebp)
        : "memory", "cc");
}

static inline void
outb(uint16_t port, uint8_t data) {
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0101786:	0f b6 45 d1          	movzbl -0x2f(%ebp),%eax
c010178a:	0f b7 55 d2          	movzwl -0x2e(%ebp),%edx
c010178e:	ee                   	out    %al,(%dx)
        ide_wait_ready(iobase, 0);
c010178f:	0f b7 45 ea          	movzwl -0x16(%ebp),%eax
c0101793:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c010179a:	00 
c010179b:	89 04 24             	mov    %eax,(%esp)
c010179e:	e8 0f ff ff ff       	call   c01016b2 <ide_wait_ready>

        /* step2: send ATA identify command */
        outb(iobase + ISA_COMMAND, IDE_CMD_IDENTIFY);
c01017a3:	0f b7 45 ea          	movzwl -0x16(%ebp),%eax
c01017a7:	83 c0 07             	add    $0x7,%eax
c01017aa:	0f b7 c0             	movzwl %ax,%eax
c01017ad:	66 89 45 ce          	mov    %ax,-0x32(%ebp)
c01017b1:	c6 45 cd ec          	movb   $0xec,-0x33(%ebp)
c01017b5:	0f b6 45 cd          	movzbl -0x33(%ebp),%eax
c01017b9:	0f b7 55 ce          	movzwl -0x32(%ebp),%edx
c01017bd:	ee                   	out    %al,(%dx)
        ide_wait_ready(iobase, 0);
c01017be:	0f b7 45 ea          	movzwl -0x16(%ebp),%eax
c01017c2:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c01017c9:	00 
c01017ca:	89 04 24             	mov    %eax,(%esp)
c01017cd:	e8 e0 fe ff ff       	call   c01016b2 <ide_wait_ready>

        /* step3: polling */
        if (inb(iobase + ISA_STATUS) == 0 || ide_wait_ready(iobase, 1) != 0) {
c01017d2:	0f b7 45 ea          	movzwl -0x16(%ebp),%eax
c01017d6:	83 c0 07             	add    $0x7,%eax
c01017d9:	0f b7 c0             	movzwl %ax,%eax
c01017dc:	66 89 45 ca          	mov    %ax,-0x36(%ebp)
static inline void invlpg(void *addr) __attribute__((always_inline));

static inline uint8_t
inb(uint16_t port) {
    uint8_t data;
    asm volatile ("inb %1, %0" : "=a" (data) : "d" (port) : "memory");
c01017e0:	0f b7 45 ca          	movzwl -0x36(%ebp),%eax
c01017e4:	89 c2                	mov    %eax,%edx
c01017e6:	ec                   	in     (%dx),%al
c01017e7:	88 45 c9             	mov    %al,-0x37(%ebp)
    return data;
c01017ea:	0f b6 45 c9          	movzbl -0x37(%ebp),%eax
c01017ee:	84 c0                	test   %al,%al
c01017f0:	0f 84 f7 01 00 00    	je     c01019ed <ide_init+0x2e1>
c01017f6:	0f b7 45 ea          	movzwl -0x16(%ebp),%eax
c01017fa:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c0101801:	00 
c0101802:	89 04 24             	mov    %eax,(%esp)
c0101805:	e8 a8 fe ff ff       	call   c01016b2 <ide_wait_ready>
c010180a:	85 c0                	test   %eax,%eax
c010180c:	0f 85 db 01 00 00    	jne    c01019ed <ide_init+0x2e1>
            continue ;
        }

        /* device is ok */
        ide_devices[ideno].valid = 1;
c0101812:	0f b7 45 f6          	movzwl -0xa(%ebp),%eax
c0101816:	c1 e0 03             	shl    $0x3,%eax
c0101819:	8d 14 c5 00 00 00 00 	lea    0x0(,%eax,8),%edx
c0101820:	29 c2                	sub    %eax,%edx
c0101822:	8d 82 00 11 12 c0    	lea    -0x3fedef00(%edx),%eax
c0101828:	c6 00 01             	movb   $0x1,(%eax)

        /* read identification space of the device */
        unsigned int buffer[128];
        insl(iobase + ISA_DATA, buffer, sizeof(buffer) / sizeof(unsigned int));
c010182b:	0f b7 45 ea          	movzwl -0x16(%ebp),%eax
c010182f:	89 45 c4             	mov    %eax,-0x3c(%ebp)
c0101832:	8d 85 bc fd ff ff    	lea    -0x244(%ebp),%eax
c0101838:	89 45 c0             	mov    %eax,-0x40(%ebp)
c010183b:	c7 45 bc 80 00 00 00 	movl   $0x80,-0x44(%ebp)
}

static inline void
insl(uint32_t port, void *addr, int cnt) {
    asm volatile (
c0101842:	8b 55 c4             	mov    -0x3c(%ebp),%edx
c0101845:	8b 4d c0             	mov    -0x40(%ebp),%ecx
c0101848:	8b 45 bc             	mov    -0x44(%ebp),%eax
c010184b:	89 cb                	mov    %ecx,%ebx
c010184d:	89 df                	mov    %ebx,%edi
c010184f:	89 c1                	mov    %eax,%ecx
c0101851:	fc                   	cld    
c0101852:	f2 6d                	repnz insl (%dx),%es:(%edi)
c0101854:	89 c8                	mov    %ecx,%eax
c0101856:	89 fb                	mov    %edi,%ebx
c0101858:	89 5d c0             	mov    %ebx,-0x40(%ebp)
c010185b:	89 45 bc             	mov    %eax,-0x44(%ebp)

        unsigned char *ident = (unsigned char *)buffer;
c010185e:	8d 85 bc fd ff ff    	lea    -0x244(%ebp),%eax
c0101864:	89 45 e4             	mov    %eax,-0x1c(%ebp)
        unsigned int sectors;
        unsigned int cmdsets = *(unsigned int *)(ident + IDE_IDENT_CMDSETS);
c0101867:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c010186a:	8b 80 a4 00 00 00    	mov    0xa4(%eax),%eax
c0101870:	89 45 e0             	mov    %eax,-0x20(%ebp)
        /* device use 48-bits or 28-bits addressing */
        if (cmdsets & (1 << 26)) {
c0101873:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0101876:	25 00 00 00 04       	and    $0x4000000,%eax
c010187b:	85 c0                	test   %eax,%eax
c010187d:	74 0e                	je     c010188d <ide_init+0x181>
            sectors = *(unsigned int *)(ident + IDE_IDENT_MAX_LBA_EXT);
c010187f:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0101882:	8b 80 c8 00 00 00    	mov    0xc8(%eax),%eax
c0101888:	89 45 f0             	mov    %eax,-0x10(%ebp)
c010188b:	eb 09                	jmp    c0101896 <ide_init+0x18a>
        }
        else {
            sectors = *(unsigned int *)(ident + IDE_IDENT_MAX_LBA);
c010188d:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0101890:	8b 40 78             	mov    0x78(%eax),%eax
c0101893:	89 45 f0             	mov    %eax,-0x10(%ebp)
        }
        ide_devices[ideno].sets = cmdsets;
c0101896:	0f b7 45 f6          	movzwl -0xa(%ebp),%eax
c010189a:	c1 e0 03             	shl    $0x3,%eax
c010189d:	8d 14 c5 00 00 00 00 	lea    0x0(,%eax,8),%edx
c01018a4:	29 c2                	sub    %eax,%edx
c01018a6:	81 c2 00 11 12 c0    	add    $0xc0121100,%edx
c01018ac:	8b 45 e0             	mov    -0x20(%ebp),%eax
c01018af:	89 42 04             	mov    %eax,0x4(%edx)
        ide_devices[ideno].size = sectors;
c01018b2:	0f b7 45 f6          	movzwl -0xa(%ebp),%eax
c01018b6:	c1 e0 03             	shl    $0x3,%eax
c01018b9:	8d 14 c5 00 00 00 00 	lea    0x0(,%eax,8),%edx
c01018c0:	29 c2                	sub    %eax,%edx
c01018c2:	81 c2 00 11 12 c0    	add    $0xc0121100,%edx
c01018c8:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01018cb:	89 42 08             	mov    %eax,0x8(%edx)

        /* check if supports LBA */
        assert((*(unsigned short *)(ident + IDE_IDENT_CAPABILITIES) & 0x200) != 0);
c01018ce:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c01018d1:	83 c0 62             	add    $0x62,%eax
c01018d4:	0f b7 00             	movzwl (%eax),%eax
c01018d7:	0f b7 c0             	movzwl %ax,%eax
c01018da:	25 00 02 00 00       	and    $0x200,%eax
c01018df:	85 c0                	test   %eax,%eax
c01018e1:	75 24                	jne    c0101907 <ide_init+0x1fb>
c01018e3:	c7 44 24 0c 50 8f 10 	movl   $0xc0108f50,0xc(%esp)
c01018ea:	c0 
c01018eb:	c7 44 24 08 93 8f 10 	movl   $0xc0108f93,0x8(%esp)
c01018f2:	c0 
c01018f3:	c7 44 24 04 7d 00 00 	movl   $0x7d,0x4(%esp)
c01018fa:	00 
c01018fb:	c7 04 24 a8 8f 10 c0 	movl   $0xc0108fa8,(%esp)
c0101902:	e8 ce f3 ff ff       	call   c0100cd5 <__panic>

        unsigned char *model = ide_devices[ideno].model, *data = ident + IDE_IDENT_MODEL;
c0101907:	0f b7 45 f6          	movzwl -0xa(%ebp),%eax
c010190b:	c1 e0 03             	shl    $0x3,%eax
c010190e:	8d 14 c5 00 00 00 00 	lea    0x0(,%eax,8),%edx
c0101915:	29 c2                	sub    %eax,%edx
c0101917:	8d 82 00 11 12 c0    	lea    -0x3fedef00(%edx),%eax
c010191d:	83 c0 0c             	add    $0xc,%eax
c0101920:	89 45 dc             	mov    %eax,-0x24(%ebp)
c0101923:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0101926:	83 c0 36             	add    $0x36,%eax
c0101929:	89 45 d8             	mov    %eax,-0x28(%ebp)
        unsigned int i, length = 40;
c010192c:	c7 45 d4 28 00 00 00 	movl   $0x28,-0x2c(%ebp)
        for (i = 0; i < length; i += 2) {
c0101933:	c7 45 ec 00 00 00 00 	movl   $0x0,-0x14(%ebp)
c010193a:	eb 34                	jmp    c0101970 <ide_init+0x264>
            model[i] = data[i + 1], model[i + 1] = data[i];
c010193c:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010193f:	8b 55 dc             	mov    -0x24(%ebp),%edx
c0101942:	01 c2                	add    %eax,%edx
c0101944:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0101947:	8d 48 01             	lea    0x1(%eax),%ecx
c010194a:	8b 45 d8             	mov    -0x28(%ebp),%eax
c010194d:	01 c8                	add    %ecx,%eax
c010194f:	0f b6 00             	movzbl (%eax),%eax
c0101952:	88 02                	mov    %al,(%edx)
c0101954:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0101957:	8d 50 01             	lea    0x1(%eax),%edx
c010195a:	8b 45 dc             	mov    -0x24(%ebp),%eax
c010195d:	01 c2                	add    %eax,%edx
c010195f:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0101962:	8b 4d d8             	mov    -0x28(%ebp),%ecx
c0101965:	01 c8                	add    %ecx,%eax
c0101967:	0f b6 00             	movzbl (%eax),%eax
c010196a:	88 02                	mov    %al,(%edx)
        /* check if supports LBA */
        assert((*(unsigned short *)(ident + IDE_IDENT_CAPABILITIES) & 0x200) != 0);

        unsigned char *model = ide_devices[ideno].model, *data = ident + IDE_IDENT_MODEL;
        unsigned int i, length = 40;
        for (i = 0; i < length; i += 2) {
c010196c:	83 45 ec 02          	addl   $0x2,-0x14(%ebp)
c0101970:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0101973:	3b 45 d4             	cmp    -0x2c(%ebp),%eax
c0101976:	72 c4                	jb     c010193c <ide_init+0x230>
            model[i] = data[i + 1], model[i + 1] = data[i];
        }
        do {
            model[i] = '\0';
c0101978:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010197b:	8b 55 dc             	mov    -0x24(%ebp),%edx
c010197e:	01 d0                	add    %edx,%eax
c0101980:	c6 00 00             	movb   $0x0,(%eax)
        } while (i -- > 0 && model[i] == ' ');
c0101983:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0101986:	8d 50 ff             	lea    -0x1(%eax),%edx
c0101989:	89 55 ec             	mov    %edx,-0x14(%ebp)
c010198c:	85 c0                	test   %eax,%eax
c010198e:	74 0f                	je     c010199f <ide_init+0x293>
c0101990:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0101993:	8b 55 dc             	mov    -0x24(%ebp),%edx
c0101996:	01 d0                	add    %edx,%eax
c0101998:	0f b6 00             	movzbl (%eax),%eax
c010199b:	3c 20                	cmp    $0x20,%al
c010199d:	74 d9                	je     c0101978 <ide_init+0x26c>

        cprintf("ide %d: %10u(sectors), '%s'.\n", ideno, ide_devices[ideno].size, ide_devices[ideno].model);
c010199f:	0f b7 45 f6          	movzwl -0xa(%ebp),%eax
c01019a3:	c1 e0 03             	shl    $0x3,%eax
c01019a6:	8d 14 c5 00 00 00 00 	lea    0x0(,%eax,8),%edx
c01019ad:	29 c2                	sub    %eax,%edx
c01019af:	8d 82 00 11 12 c0    	lea    -0x3fedef00(%edx),%eax
c01019b5:	8d 48 0c             	lea    0xc(%eax),%ecx
c01019b8:	0f b7 45 f6          	movzwl -0xa(%ebp),%eax
c01019bc:	c1 e0 03             	shl    $0x3,%eax
c01019bf:	8d 14 c5 00 00 00 00 	lea    0x0(,%eax,8),%edx
c01019c6:	29 c2                	sub    %eax,%edx
c01019c8:	8d 82 00 11 12 c0    	lea    -0x3fedef00(%edx),%eax
c01019ce:	8b 50 08             	mov    0x8(%eax),%edx
c01019d1:	0f b7 45 f6          	movzwl -0xa(%ebp),%eax
c01019d5:	89 4c 24 0c          	mov    %ecx,0xc(%esp)
c01019d9:	89 54 24 08          	mov    %edx,0x8(%esp)
c01019dd:	89 44 24 04          	mov    %eax,0x4(%esp)
c01019e1:	c7 04 24 ba 8f 10 c0 	movl   $0xc0108fba,(%esp)
c01019e8:	e8 5e e9 ff ff       	call   c010034b <cprintf>

void
ide_init(void) {
    static_assert((SECTSIZE % 4) == 0);
    unsigned short ideno, iobase;
    for (ideno = 0; ideno < MAX_IDE; ideno ++) {
c01019ed:	0f b7 45 f6          	movzwl -0xa(%ebp),%eax
c01019f1:	83 c0 01             	add    $0x1,%eax
c01019f4:	66 89 45 f6          	mov    %ax,-0xa(%ebp)
c01019f8:	66 83 7d f6 03       	cmpw   $0x3,-0xa(%ebp)
c01019fd:	0f 86 1f fd ff ff    	jbe    c0101722 <ide_init+0x16>

        cprintf("ide %d: %10u(sectors), '%s'.\n", ideno, ide_devices[ideno].size, ide_devices[ideno].model);
    }

    // enable ide interrupt
    pic_enable(IRQ_IDE1);
c0101a03:	c7 04 24 0e 00 00 00 	movl   $0xe,(%esp)
c0101a0a:	e8 7c 05 00 00       	call   c0101f8b <pic_enable>
    pic_enable(IRQ_IDE2);
c0101a0f:	c7 04 24 0f 00 00 00 	movl   $0xf,(%esp)
c0101a16:	e8 70 05 00 00       	call   c0101f8b <pic_enable>
}
c0101a1b:	81 c4 50 02 00 00    	add    $0x250,%esp
c0101a21:	5b                   	pop    %ebx
c0101a22:	5f                   	pop    %edi
c0101a23:	5d                   	pop    %ebp
c0101a24:	c3                   	ret    

c0101a25 <ide_device_valid>:

bool
ide_device_valid(unsigned short ideno) {
c0101a25:	55                   	push   %ebp
c0101a26:	89 e5                	mov    %esp,%ebp
c0101a28:	83 ec 04             	sub    $0x4,%esp
c0101a2b:	8b 45 08             	mov    0x8(%ebp),%eax
c0101a2e:	66 89 45 fc          	mov    %ax,-0x4(%ebp)
    return VALID_IDE(ideno);
c0101a32:	66 83 7d fc 03       	cmpw   $0x3,-0x4(%ebp)
c0101a37:	77 24                	ja     c0101a5d <ide_device_valid+0x38>
c0101a39:	0f b7 45 fc          	movzwl -0x4(%ebp),%eax
c0101a3d:	c1 e0 03             	shl    $0x3,%eax
c0101a40:	8d 14 c5 00 00 00 00 	lea    0x0(,%eax,8),%edx
c0101a47:	29 c2                	sub    %eax,%edx
c0101a49:	8d 82 00 11 12 c0    	lea    -0x3fedef00(%edx),%eax
c0101a4f:	0f b6 00             	movzbl (%eax),%eax
c0101a52:	84 c0                	test   %al,%al
c0101a54:	74 07                	je     c0101a5d <ide_device_valid+0x38>
c0101a56:	b8 01 00 00 00       	mov    $0x1,%eax
c0101a5b:	eb 05                	jmp    c0101a62 <ide_device_valid+0x3d>
c0101a5d:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0101a62:	c9                   	leave  
c0101a63:	c3                   	ret    

c0101a64 <ide_device_size>:

size_t
ide_device_size(unsigned short ideno) {
c0101a64:	55                   	push   %ebp
c0101a65:	89 e5                	mov    %esp,%ebp
c0101a67:	83 ec 08             	sub    $0x8,%esp
c0101a6a:	8b 45 08             	mov    0x8(%ebp),%eax
c0101a6d:	66 89 45 fc          	mov    %ax,-0x4(%ebp)
    if (ide_device_valid(ideno)) {
c0101a71:	0f b7 45 fc          	movzwl -0x4(%ebp),%eax
c0101a75:	89 04 24             	mov    %eax,(%esp)
c0101a78:	e8 a8 ff ff ff       	call   c0101a25 <ide_device_valid>
c0101a7d:	85 c0                	test   %eax,%eax
c0101a7f:	74 1b                	je     c0101a9c <ide_device_size+0x38>
        return ide_devices[ideno].size;
c0101a81:	0f b7 45 fc          	movzwl -0x4(%ebp),%eax
c0101a85:	c1 e0 03             	shl    $0x3,%eax
c0101a88:	8d 14 c5 00 00 00 00 	lea    0x0(,%eax,8),%edx
c0101a8f:	29 c2                	sub    %eax,%edx
c0101a91:	8d 82 00 11 12 c0    	lea    -0x3fedef00(%edx),%eax
c0101a97:	8b 40 08             	mov    0x8(%eax),%eax
c0101a9a:	eb 05                	jmp    c0101aa1 <ide_device_size+0x3d>
    }
    return 0;
c0101a9c:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0101aa1:	c9                   	leave  
c0101aa2:	c3                   	ret    

c0101aa3 <ide_read_secs>:

int
ide_read_secs(unsigned short ideno, uint32_t secno, void *dst, size_t nsecs) {
c0101aa3:	55                   	push   %ebp
c0101aa4:	89 e5                	mov    %esp,%ebp
c0101aa6:	57                   	push   %edi
c0101aa7:	53                   	push   %ebx
c0101aa8:	83 ec 50             	sub    $0x50,%esp
c0101aab:	8b 45 08             	mov    0x8(%ebp),%eax
c0101aae:	66 89 45 c4          	mov    %ax,-0x3c(%ebp)
    assert(nsecs <= MAX_NSECS && VALID_IDE(ideno));
c0101ab2:	81 7d 14 80 00 00 00 	cmpl   $0x80,0x14(%ebp)
c0101ab9:	77 24                	ja     c0101adf <ide_read_secs+0x3c>
c0101abb:	66 83 7d c4 03       	cmpw   $0x3,-0x3c(%ebp)
c0101ac0:	77 1d                	ja     c0101adf <ide_read_secs+0x3c>
c0101ac2:	0f b7 45 c4          	movzwl -0x3c(%ebp),%eax
c0101ac6:	c1 e0 03             	shl    $0x3,%eax
c0101ac9:	8d 14 c5 00 00 00 00 	lea    0x0(,%eax,8),%edx
c0101ad0:	29 c2                	sub    %eax,%edx
c0101ad2:	8d 82 00 11 12 c0    	lea    -0x3fedef00(%edx),%eax
c0101ad8:	0f b6 00             	movzbl (%eax),%eax
c0101adb:	84 c0                	test   %al,%al
c0101add:	75 24                	jne    c0101b03 <ide_read_secs+0x60>
c0101adf:	c7 44 24 0c d8 8f 10 	movl   $0xc0108fd8,0xc(%esp)
c0101ae6:	c0 
c0101ae7:	c7 44 24 08 93 8f 10 	movl   $0xc0108f93,0x8(%esp)
c0101aee:	c0 
c0101aef:	c7 44 24 04 9f 00 00 	movl   $0x9f,0x4(%esp)
c0101af6:	00 
c0101af7:	c7 04 24 a8 8f 10 c0 	movl   $0xc0108fa8,(%esp)
c0101afe:	e8 d2 f1 ff ff       	call   c0100cd5 <__panic>
    assert(secno < MAX_DISK_NSECS && secno + nsecs <= MAX_DISK_NSECS);
c0101b03:	81 7d 0c ff ff ff 0f 	cmpl   $0xfffffff,0xc(%ebp)
c0101b0a:	77 0f                	ja     c0101b1b <ide_read_secs+0x78>
c0101b0c:	8b 45 14             	mov    0x14(%ebp),%eax
c0101b0f:	8b 55 0c             	mov    0xc(%ebp),%edx
c0101b12:	01 d0                	add    %edx,%eax
c0101b14:	3d 00 00 00 10       	cmp    $0x10000000,%eax
c0101b19:	76 24                	jbe    c0101b3f <ide_read_secs+0x9c>
c0101b1b:	c7 44 24 0c 00 90 10 	movl   $0xc0109000,0xc(%esp)
c0101b22:	c0 
c0101b23:	c7 44 24 08 93 8f 10 	movl   $0xc0108f93,0x8(%esp)
c0101b2a:	c0 
c0101b2b:	c7 44 24 04 a0 00 00 	movl   $0xa0,0x4(%esp)
c0101b32:	00 
c0101b33:	c7 04 24 a8 8f 10 c0 	movl   $0xc0108fa8,(%esp)
c0101b3a:	e8 96 f1 ff ff       	call   c0100cd5 <__panic>
    unsigned short iobase = IO_BASE(ideno), ioctrl = IO_CTRL(ideno);
c0101b3f:	0f b7 45 c4          	movzwl -0x3c(%ebp),%eax
c0101b43:	66 d1 e8             	shr    %ax
c0101b46:	0f b7 c0             	movzwl %ax,%eax
c0101b49:	0f b7 04 85 48 8f 10 	movzwl -0x3fef70b8(,%eax,4),%eax
c0101b50:	c0 
c0101b51:	66 89 45 f2          	mov    %ax,-0xe(%ebp)
c0101b55:	0f b7 45 c4          	movzwl -0x3c(%ebp),%eax
c0101b59:	66 d1 e8             	shr    %ax
c0101b5c:	0f b7 c0             	movzwl %ax,%eax
c0101b5f:	0f b7 04 85 4a 8f 10 	movzwl -0x3fef70b6(,%eax,4),%eax
c0101b66:	c0 
c0101b67:	66 89 45 f0          	mov    %ax,-0x10(%ebp)

    ide_wait_ready(iobase, 0);
c0101b6b:	0f b7 45 f2          	movzwl -0xe(%ebp),%eax
c0101b6f:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c0101b76:	00 
c0101b77:	89 04 24             	mov    %eax,(%esp)
c0101b7a:	e8 33 fb ff ff       	call   c01016b2 <ide_wait_ready>

    // generate interrupt
    outb(ioctrl + ISA_CTRL, 0);
c0101b7f:	0f b7 45 f0          	movzwl -0x10(%ebp),%eax
c0101b83:	83 c0 02             	add    $0x2,%eax
c0101b86:	0f b7 c0             	movzwl %ax,%eax
c0101b89:	66 89 45 ee          	mov    %ax,-0x12(%ebp)
c0101b8d:	c6 45 ed 00          	movb   $0x0,-0x13(%ebp)
        : "memory", "cc");
}

static inline void
outb(uint16_t port, uint8_t data) {
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0101b91:	0f b6 45 ed          	movzbl -0x13(%ebp),%eax
c0101b95:	0f b7 55 ee          	movzwl -0x12(%ebp),%edx
c0101b99:	ee                   	out    %al,(%dx)
    outb(iobase + ISA_SECCNT, nsecs);
c0101b9a:	8b 45 14             	mov    0x14(%ebp),%eax
c0101b9d:	0f b6 c0             	movzbl %al,%eax
c0101ba0:	0f b7 55 f2          	movzwl -0xe(%ebp),%edx
c0101ba4:	83 c2 02             	add    $0x2,%edx
c0101ba7:	0f b7 d2             	movzwl %dx,%edx
c0101baa:	66 89 55 ea          	mov    %dx,-0x16(%ebp)
c0101bae:	88 45 e9             	mov    %al,-0x17(%ebp)
c0101bb1:	0f b6 45 e9          	movzbl -0x17(%ebp),%eax
c0101bb5:	0f b7 55 ea          	movzwl -0x16(%ebp),%edx
c0101bb9:	ee                   	out    %al,(%dx)
    outb(iobase + ISA_SECTOR, secno & 0xFF);
c0101bba:	8b 45 0c             	mov    0xc(%ebp),%eax
c0101bbd:	0f b6 c0             	movzbl %al,%eax
c0101bc0:	0f b7 55 f2          	movzwl -0xe(%ebp),%edx
c0101bc4:	83 c2 03             	add    $0x3,%edx
c0101bc7:	0f b7 d2             	movzwl %dx,%edx
c0101bca:	66 89 55 e6          	mov    %dx,-0x1a(%ebp)
c0101bce:	88 45 e5             	mov    %al,-0x1b(%ebp)
c0101bd1:	0f b6 45 e5          	movzbl -0x1b(%ebp),%eax
c0101bd5:	0f b7 55 e6          	movzwl -0x1a(%ebp),%edx
c0101bd9:	ee                   	out    %al,(%dx)
    outb(iobase + ISA_CYL_LO, (secno >> 8) & 0xFF);
c0101bda:	8b 45 0c             	mov    0xc(%ebp),%eax
c0101bdd:	c1 e8 08             	shr    $0x8,%eax
c0101be0:	0f b6 c0             	movzbl %al,%eax
c0101be3:	0f b7 55 f2          	movzwl -0xe(%ebp),%edx
c0101be7:	83 c2 04             	add    $0x4,%edx
c0101bea:	0f b7 d2             	movzwl %dx,%edx
c0101bed:	66 89 55 e2          	mov    %dx,-0x1e(%ebp)
c0101bf1:	88 45 e1             	mov    %al,-0x1f(%ebp)
c0101bf4:	0f b6 45 e1          	movzbl -0x1f(%ebp),%eax
c0101bf8:	0f b7 55 e2          	movzwl -0x1e(%ebp),%edx
c0101bfc:	ee                   	out    %al,(%dx)
    outb(iobase + ISA_CYL_HI, (secno >> 16) & 0xFF);
c0101bfd:	8b 45 0c             	mov    0xc(%ebp),%eax
c0101c00:	c1 e8 10             	shr    $0x10,%eax
c0101c03:	0f b6 c0             	movzbl %al,%eax
c0101c06:	0f b7 55 f2          	movzwl -0xe(%ebp),%edx
c0101c0a:	83 c2 05             	add    $0x5,%edx
c0101c0d:	0f b7 d2             	movzwl %dx,%edx
c0101c10:	66 89 55 de          	mov    %dx,-0x22(%ebp)
c0101c14:	88 45 dd             	mov    %al,-0x23(%ebp)
c0101c17:	0f b6 45 dd          	movzbl -0x23(%ebp),%eax
c0101c1b:	0f b7 55 de          	movzwl -0x22(%ebp),%edx
c0101c1f:	ee                   	out    %al,(%dx)
    outb(iobase + ISA_SDH, 0xE0 | ((ideno & 1) << 4) | ((secno >> 24) & 0xF));
c0101c20:	0f b7 45 c4          	movzwl -0x3c(%ebp),%eax
c0101c24:	83 e0 01             	and    $0x1,%eax
c0101c27:	c1 e0 04             	shl    $0x4,%eax
c0101c2a:	89 c2                	mov    %eax,%edx
c0101c2c:	8b 45 0c             	mov    0xc(%ebp),%eax
c0101c2f:	c1 e8 18             	shr    $0x18,%eax
c0101c32:	83 e0 0f             	and    $0xf,%eax
c0101c35:	09 d0                	or     %edx,%eax
c0101c37:	83 c8 e0             	or     $0xffffffe0,%eax
c0101c3a:	0f b6 c0             	movzbl %al,%eax
c0101c3d:	0f b7 55 f2          	movzwl -0xe(%ebp),%edx
c0101c41:	83 c2 06             	add    $0x6,%edx
c0101c44:	0f b7 d2             	movzwl %dx,%edx
c0101c47:	66 89 55 da          	mov    %dx,-0x26(%ebp)
c0101c4b:	88 45 d9             	mov    %al,-0x27(%ebp)
c0101c4e:	0f b6 45 d9          	movzbl -0x27(%ebp),%eax
c0101c52:	0f b7 55 da          	movzwl -0x26(%ebp),%edx
c0101c56:	ee                   	out    %al,(%dx)
    outb(iobase + ISA_COMMAND, IDE_CMD_READ);
c0101c57:	0f b7 45 f2          	movzwl -0xe(%ebp),%eax
c0101c5b:	83 c0 07             	add    $0x7,%eax
c0101c5e:	0f b7 c0             	movzwl %ax,%eax
c0101c61:	66 89 45 d6          	mov    %ax,-0x2a(%ebp)
c0101c65:	c6 45 d5 20          	movb   $0x20,-0x2b(%ebp)
c0101c69:	0f b6 45 d5          	movzbl -0x2b(%ebp),%eax
c0101c6d:	0f b7 55 d6          	movzwl -0x2a(%ebp),%edx
c0101c71:	ee                   	out    %al,(%dx)

    int ret = 0;
c0101c72:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
    for (; nsecs > 0; nsecs --, dst += SECTSIZE) {
c0101c79:	eb 5a                	jmp    c0101cd5 <ide_read_secs+0x232>
        if ((ret = ide_wait_ready(iobase, 1)) != 0) {
c0101c7b:	0f b7 45 f2          	movzwl -0xe(%ebp),%eax
c0101c7f:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c0101c86:	00 
c0101c87:	89 04 24             	mov    %eax,(%esp)
c0101c8a:	e8 23 fa ff ff       	call   c01016b2 <ide_wait_ready>
c0101c8f:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0101c92:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0101c96:	74 02                	je     c0101c9a <ide_read_secs+0x1f7>
            goto out;
c0101c98:	eb 41                	jmp    c0101cdb <ide_read_secs+0x238>
        }
        insl(iobase, dst, SECTSIZE / sizeof(uint32_t));
c0101c9a:	0f b7 45 f2          	movzwl -0xe(%ebp),%eax
c0101c9e:	89 45 d0             	mov    %eax,-0x30(%ebp)
c0101ca1:	8b 45 10             	mov    0x10(%ebp),%eax
c0101ca4:	89 45 cc             	mov    %eax,-0x34(%ebp)
c0101ca7:	c7 45 c8 80 00 00 00 	movl   $0x80,-0x38(%ebp)
    return data;
}

static inline void
insl(uint32_t port, void *addr, int cnt) {
    asm volatile (
c0101cae:	8b 55 d0             	mov    -0x30(%ebp),%edx
c0101cb1:	8b 4d cc             	mov    -0x34(%ebp),%ecx
c0101cb4:	8b 45 c8             	mov    -0x38(%ebp),%eax
c0101cb7:	89 cb                	mov    %ecx,%ebx
c0101cb9:	89 df                	mov    %ebx,%edi
c0101cbb:	89 c1                	mov    %eax,%ecx
c0101cbd:	fc                   	cld    
c0101cbe:	f2 6d                	repnz insl (%dx),%es:(%edi)
c0101cc0:	89 c8                	mov    %ecx,%eax
c0101cc2:	89 fb                	mov    %edi,%ebx
c0101cc4:	89 5d cc             	mov    %ebx,-0x34(%ebp)
c0101cc7:	89 45 c8             	mov    %eax,-0x38(%ebp)
    outb(iobase + ISA_CYL_HI, (secno >> 16) & 0xFF);
    outb(iobase + ISA_SDH, 0xE0 | ((ideno & 1) << 4) | ((secno >> 24) & 0xF));
    outb(iobase + ISA_COMMAND, IDE_CMD_READ);

    int ret = 0;
    for (; nsecs > 0; nsecs --, dst += SECTSIZE) {
c0101cca:	83 6d 14 01          	subl   $0x1,0x14(%ebp)
c0101cce:	81 45 10 00 02 00 00 	addl   $0x200,0x10(%ebp)
c0101cd5:	83 7d 14 00          	cmpl   $0x0,0x14(%ebp)
c0101cd9:	75 a0                	jne    c0101c7b <ide_read_secs+0x1d8>
        }
        insl(iobase, dst, SECTSIZE / sizeof(uint32_t));
    }

out:
    return ret;
c0101cdb:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c0101cde:	83 c4 50             	add    $0x50,%esp
c0101ce1:	5b                   	pop    %ebx
c0101ce2:	5f                   	pop    %edi
c0101ce3:	5d                   	pop    %ebp
c0101ce4:	c3                   	ret    

c0101ce5 <ide_write_secs>:

int
ide_write_secs(unsigned short ideno, uint32_t secno, const void *src, size_t nsecs) {
c0101ce5:	55                   	push   %ebp
c0101ce6:	89 e5                	mov    %esp,%ebp
c0101ce8:	56                   	push   %esi
c0101ce9:	53                   	push   %ebx
c0101cea:	83 ec 50             	sub    $0x50,%esp
c0101ced:	8b 45 08             	mov    0x8(%ebp),%eax
c0101cf0:	66 89 45 c4          	mov    %ax,-0x3c(%ebp)
    assert(nsecs <= MAX_NSECS && VALID_IDE(ideno));
c0101cf4:	81 7d 14 80 00 00 00 	cmpl   $0x80,0x14(%ebp)
c0101cfb:	77 24                	ja     c0101d21 <ide_write_secs+0x3c>
c0101cfd:	66 83 7d c4 03       	cmpw   $0x3,-0x3c(%ebp)
c0101d02:	77 1d                	ja     c0101d21 <ide_write_secs+0x3c>
c0101d04:	0f b7 45 c4          	movzwl -0x3c(%ebp),%eax
c0101d08:	c1 e0 03             	shl    $0x3,%eax
c0101d0b:	8d 14 c5 00 00 00 00 	lea    0x0(,%eax,8),%edx
c0101d12:	29 c2                	sub    %eax,%edx
c0101d14:	8d 82 00 11 12 c0    	lea    -0x3fedef00(%edx),%eax
c0101d1a:	0f b6 00             	movzbl (%eax),%eax
c0101d1d:	84 c0                	test   %al,%al
c0101d1f:	75 24                	jne    c0101d45 <ide_write_secs+0x60>
c0101d21:	c7 44 24 0c d8 8f 10 	movl   $0xc0108fd8,0xc(%esp)
c0101d28:	c0 
c0101d29:	c7 44 24 08 93 8f 10 	movl   $0xc0108f93,0x8(%esp)
c0101d30:	c0 
c0101d31:	c7 44 24 04 bc 00 00 	movl   $0xbc,0x4(%esp)
c0101d38:	00 
c0101d39:	c7 04 24 a8 8f 10 c0 	movl   $0xc0108fa8,(%esp)
c0101d40:	e8 90 ef ff ff       	call   c0100cd5 <__panic>
    assert(secno < MAX_DISK_NSECS && secno + nsecs <= MAX_DISK_NSECS);
c0101d45:	81 7d 0c ff ff ff 0f 	cmpl   $0xfffffff,0xc(%ebp)
c0101d4c:	77 0f                	ja     c0101d5d <ide_write_secs+0x78>
c0101d4e:	8b 45 14             	mov    0x14(%ebp),%eax
c0101d51:	8b 55 0c             	mov    0xc(%ebp),%edx
c0101d54:	01 d0                	add    %edx,%eax
c0101d56:	3d 00 00 00 10       	cmp    $0x10000000,%eax
c0101d5b:	76 24                	jbe    c0101d81 <ide_write_secs+0x9c>
c0101d5d:	c7 44 24 0c 00 90 10 	movl   $0xc0109000,0xc(%esp)
c0101d64:	c0 
c0101d65:	c7 44 24 08 93 8f 10 	movl   $0xc0108f93,0x8(%esp)
c0101d6c:	c0 
c0101d6d:	c7 44 24 04 bd 00 00 	movl   $0xbd,0x4(%esp)
c0101d74:	00 
c0101d75:	c7 04 24 a8 8f 10 c0 	movl   $0xc0108fa8,(%esp)
c0101d7c:	e8 54 ef ff ff       	call   c0100cd5 <__panic>
    unsigned short iobase = IO_BASE(ideno), ioctrl = IO_CTRL(ideno);
c0101d81:	0f b7 45 c4          	movzwl -0x3c(%ebp),%eax
c0101d85:	66 d1 e8             	shr    %ax
c0101d88:	0f b7 c0             	movzwl %ax,%eax
c0101d8b:	0f b7 04 85 48 8f 10 	movzwl -0x3fef70b8(,%eax,4),%eax
c0101d92:	c0 
c0101d93:	66 89 45 f2          	mov    %ax,-0xe(%ebp)
c0101d97:	0f b7 45 c4          	movzwl -0x3c(%ebp),%eax
c0101d9b:	66 d1 e8             	shr    %ax
c0101d9e:	0f b7 c0             	movzwl %ax,%eax
c0101da1:	0f b7 04 85 4a 8f 10 	movzwl -0x3fef70b6(,%eax,4),%eax
c0101da8:	c0 
c0101da9:	66 89 45 f0          	mov    %ax,-0x10(%ebp)

    ide_wait_ready(iobase, 0);
c0101dad:	0f b7 45 f2          	movzwl -0xe(%ebp),%eax
c0101db1:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c0101db8:	00 
c0101db9:	89 04 24             	mov    %eax,(%esp)
c0101dbc:	e8 f1 f8 ff ff       	call   c01016b2 <ide_wait_ready>

    // generate interrupt
    outb(ioctrl + ISA_CTRL, 0);
c0101dc1:	0f b7 45 f0          	movzwl -0x10(%ebp),%eax
c0101dc5:	83 c0 02             	add    $0x2,%eax
c0101dc8:	0f b7 c0             	movzwl %ax,%eax
c0101dcb:	66 89 45 ee          	mov    %ax,-0x12(%ebp)
c0101dcf:	c6 45 ed 00          	movb   $0x0,-0x13(%ebp)
        : "memory", "cc");
}

static inline void
outb(uint16_t port, uint8_t data) {
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0101dd3:	0f b6 45 ed          	movzbl -0x13(%ebp),%eax
c0101dd7:	0f b7 55 ee          	movzwl -0x12(%ebp),%edx
c0101ddb:	ee                   	out    %al,(%dx)
    outb(iobase + ISA_SECCNT, nsecs);
c0101ddc:	8b 45 14             	mov    0x14(%ebp),%eax
c0101ddf:	0f b6 c0             	movzbl %al,%eax
c0101de2:	0f b7 55 f2          	movzwl -0xe(%ebp),%edx
c0101de6:	83 c2 02             	add    $0x2,%edx
c0101de9:	0f b7 d2             	movzwl %dx,%edx
c0101dec:	66 89 55 ea          	mov    %dx,-0x16(%ebp)
c0101df0:	88 45 e9             	mov    %al,-0x17(%ebp)
c0101df3:	0f b6 45 e9          	movzbl -0x17(%ebp),%eax
c0101df7:	0f b7 55 ea          	movzwl -0x16(%ebp),%edx
c0101dfb:	ee                   	out    %al,(%dx)
    outb(iobase + ISA_SECTOR, secno & 0xFF);
c0101dfc:	8b 45 0c             	mov    0xc(%ebp),%eax
c0101dff:	0f b6 c0             	movzbl %al,%eax
c0101e02:	0f b7 55 f2          	movzwl -0xe(%ebp),%edx
c0101e06:	83 c2 03             	add    $0x3,%edx
c0101e09:	0f b7 d2             	movzwl %dx,%edx
c0101e0c:	66 89 55 e6          	mov    %dx,-0x1a(%ebp)
c0101e10:	88 45 e5             	mov    %al,-0x1b(%ebp)
c0101e13:	0f b6 45 e5          	movzbl -0x1b(%ebp),%eax
c0101e17:	0f b7 55 e6          	movzwl -0x1a(%ebp),%edx
c0101e1b:	ee                   	out    %al,(%dx)
    outb(iobase + ISA_CYL_LO, (secno >> 8) & 0xFF);
c0101e1c:	8b 45 0c             	mov    0xc(%ebp),%eax
c0101e1f:	c1 e8 08             	shr    $0x8,%eax
c0101e22:	0f b6 c0             	movzbl %al,%eax
c0101e25:	0f b7 55 f2          	movzwl -0xe(%ebp),%edx
c0101e29:	83 c2 04             	add    $0x4,%edx
c0101e2c:	0f b7 d2             	movzwl %dx,%edx
c0101e2f:	66 89 55 e2          	mov    %dx,-0x1e(%ebp)
c0101e33:	88 45 e1             	mov    %al,-0x1f(%ebp)
c0101e36:	0f b6 45 e1          	movzbl -0x1f(%ebp),%eax
c0101e3a:	0f b7 55 e2          	movzwl -0x1e(%ebp),%edx
c0101e3e:	ee                   	out    %al,(%dx)
    outb(iobase + ISA_CYL_HI, (secno >> 16) & 0xFF);
c0101e3f:	8b 45 0c             	mov    0xc(%ebp),%eax
c0101e42:	c1 e8 10             	shr    $0x10,%eax
c0101e45:	0f b6 c0             	movzbl %al,%eax
c0101e48:	0f b7 55 f2          	movzwl -0xe(%ebp),%edx
c0101e4c:	83 c2 05             	add    $0x5,%edx
c0101e4f:	0f b7 d2             	movzwl %dx,%edx
c0101e52:	66 89 55 de          	mov    %dx,-0x22(%ebp)
c0101e56:	88 45 dd             	mov    %al,-0x23(%ebp)
c0101e59:	0f b6 45 dd          	movzbl -0x23(%ebp),%eax
c0101e5d:	0f b7 55 de          	movzwl -0x22(%ebp),%edx
c0101e61:	ee                   	out    %al,(%dx)
    outb(iobase + ISA_SDH, 0xE0 | ((ideno & 1) << 4) | ((secno >> 24) & 0xF));
c0101e62:	0f b7 45 c4          	movzwl -0x3c(%ebp),%eax
c0101e66:	83 e0 01             	and    $0x1,%eax
c0101e69:	c1 e0 04             	shl    $0x4,%eax
c0101e6c:	89 c2                	mov    %eax,%edx
c0101e6e:	8b 45 0c             	mov    0xc(%ebp),%eax
c0101e71:	c1 e8 18             	shr    $0x18,%eax
c0101e74:	83 e0 0f             	and    $0xf,%eax
c0101e77:	09 d0                	or     %edx,%eax
c0101e79:	83 c8 e0             	or     $0xffffffe0,%eax
c0101e7c:	0f b6 c0             	movzbl %al,%eax
c0101e7f:	0f b7 55 f2          	movzwl -0xe(%ebp),%edx
c0101e83:	83 c2 06             	add    $0x6,%edx
c0101e86:	0f b7 d2             	movzwl %dx,%edx
c0101e89:	66 89 55 da          	mov    %dx,-0x26(%ebp)
c0101e8d:	88 45 d9             	mov    %al,-0x27(%ebp)
c0101e90:	0f b6 45 d9          	movzbl -0x27(%ebp),%eax
c0101e94:	0f b7 55 da          	movzwl -0x26(%ebp),%edx
c0101e98:	ee                   	out    %al,(%dx)
    outb(iobase + ISA_COMMAND, IDE_CMD_WRITE);
c0101e99:	0f b7 45 f2          	movzwl -0xe(%ebp),%eax
c0101e9d:	83 c0 07             	add    $0x7,%eax
c0101ea0:	0f b7 c0             	movzwl %ax,%eax
c0101ea3:	66 89 45 d6          	mov    %ax,-0x2a(%ebp)
c0101ea7:	c6 45 d5 30          	movb   $0x30,-0x2b(%ebp)
c0101eab:	0f b6 45 d5          	movzbl -0x2b(%ebp),%eax
c0101eaf:	0f b7 55 d6          	movzwl -0x2a(%ebp),%edx
c0101eb3:	ee                   	out    %al,(%dx)

    int ret = 0;
c0101eb4:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
    for (; nsecs > 0; nsecs --, src += SECTSIZE) {
c0101ebb:	eb 5a                	jmp    c0101f17 <ide_write_secs+0x232>
        if ((ret = ide_wait_ready(iobase, 1)) != 0) {
c0101ebd:	0f b7 45 f2          	movzwl -0xe(%ebp),%eax
c0101ec1:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c0101ec8:	00 
c0101ec9:	89 04 24             	mov    %eax,(%esp)
c0101ecc:	e8 e1 f7 ff ff       	call   c01016b2 <ide_wait_ready>
c0101ed1:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0101ed4:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0101ed8:	74 02                	je     c0101edc <ide_write_secs+0x1f7>
            goto out;
c0101eda:	eb 41                	jmp    c0101f1d <ide_write_secs+0x238>
        }
        outsl(iobase, src, SECTSIZE / sizeof(uint32_t));
c0101edc:	0f b7 45 f2          	movzwl -0xe(%ebp),%eax
c0101ee0:	89 45 d0             	mov    %eax,-0x30(%ebp)
c0101ee3:	8b 45 10             	mov    0x10(%ebp),%eax
c0101ee6:	89 45 cc             	mov    %eax,-0x34(%ebp)
c0101ee9:	c7 45 c8 80 00 00 00 	movl   $0x80,-0x38(%ebp)
    asm volatile ("outw %0, %1" :: "a" (data), "d" (port) : "memory");
}

static inline void
outsl(uint32_t port, const void *addr, int cnt) {
    asm volatile (
c0101ef0:	8b 55 d0             	mov    -0x30(%ebp),%edx
c0101ef3:	8b 4d cc             	mov    -0x34(%ebp),%ecx
c0101ef6:	8b 45 c8             	mov    -0x38(%ebp),%eax
c0101ef9:	89 cb                	mov    %ecx,%ebx
c0101efb:	89 de                	mov    %ebx,%esi
c0101efd:	89 c1                	mov    %eax,%ecx
c0101eff:	fc                   	cld    
c0101f00:	f2 6f                	repnz outsl %ds:(%esi),(%dx)
c0101f02:	89 c8                	mov    %ecx,%eax
c0101f04:	89 f3                	mov    %esi,%ebx
c0101f06:	89 5d cc             	mov    %ebx,-0x34(%ebp)
c0101f09:	89 45 c8             	mov    %eax,-0x38(%ebp)
    outb(iobase + ISA_CYL_HI, (secno >> 16) & 0xFF);
    outb(iobase + ISA_SDH, 0xE0 | ((ideno & 1) << 4) | ((secno >> 24) & 0xF));
    outb(iobase + ISA_COMMAND, IDE_CMD_WRITE);

    int ret = 0;
    for (; nsecs > 0; nsecs --, src += SECTSIZE) {
c0101f0c:	83 6d 14 01          	subl   $0x1,0x14(%ebp)
c0101f10:	81 45 10 00 02 00 00 	addl   $0x200,0x10(%ebp)
c0101f17:	83 7d 14 00          	cmpl   $0x0,0x14(%ebp)
c0101f1b:	75 a0                	jne    c0101ebd <ide_write_secs+0x1d8>
        }
        outsl(iobase, src, SECTSIZE / sizeof(uint32_t));
    }

out:
    return ret;
c0101f1d:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c0101f20:	83 c4 50             	add    $0x50,%esp
c0101f23:	5b                   	pop    %ebx
c0101f24:	5e                   	pop    %esi
c0101f25:	5d                   	pop    %ebp
c0101f26:	c3                   	ret    

c0101f27 <intr_enable>:
#include <x86.h>
#include <intr.h>

/* intr_enable - enable irq interrupt */
void
intr_enable(void) {
c0101f27:	55                   	push   %ebp
c0101f28:	89 e5                	mov    %esp,%ebp
    asm volatile ("lidt (%0)" :: "r" (pd) : "memory");
}

static inline void
sti(void) {
    asm volatile ("sti");
c0101f2a:	fb                   	sti    
    sti();
}
c0101f2b:	5d                   	pop    %ebp
c0101f2c:	c3                   	ret    

c0101f2d <intr_disable>:

/* intr_disable - disable irq interrupt */
void
intr_disable(void) {
c0101f2d:	55                   	push   %ebp
c0101f2e:	89 e5                	mov    %esp,%ebp
}

static inline void
cli(void) {
    asm volatile ("cli" ::: "memory");
c0101f30:	fa                   	cli    
    cli();
}
c0101f31:	5d                   	pop    %ebp
c0101f32:	c3                   	ret    

c0101f33 <pic_setmask>:
// Initial IRQ mask has interrupt 2 enabled (for slave 8259A).
static uint16_t irq_mask = 0xFFFF & ~(1 << IRQ_SLAVE);
static bool did_init = 0;

static void
pic_setmask(uint16_t mask) {
c0101f33:	55                   	push   %ebp
c0101f34:	89 e5                	mov    %esp,%ebp
c0101f36:	83 ec 14             	sub    $0x14,%esp
c0101f39:	8b 45 08             	mov    0x8(%ebp),%eax
c0101f3c:	66 89 45 ec          	mov    %ax,-0x14(%ebp)
    irq_mask = mask;
c0101f40:	0f b7 45 ec          	movzwl -0x14(%ebp),%eax
c0101f44:	66 a3 70 05 12 c0    	mov    %ax,0xc0120570
    if (did_init) {
c0101f4a:	a1 e0 11 12 c0       	mov    0xc01211e0,%eax
c0101f4f:	85 c0                	test   %eax,%eax
c0101f51:	74 36                	je     c0101f89 <pic_setmask+0x56>
        outb(IO_PIC1 + 1, mask);
c0101f53:	0f b7 45 ec          	movzwl -0x14(%ebp),%eax
c0101f57:	0f b6 c0             	movzbl %al,%eax
c0101f5a:	66 c7 45 fe 21 00    	movw   $0x21,-0x2(%ebp)
c0101f60:	88 45 fd             	mov    %al,-0x3(%ebp)
        : "memory", "cc");
}

static inline void
outb(uint16_t port, uint8_t data) {
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0101f63:	0f b6 45 fd          	movzbl -0x3(%ebp),%eax
c0101f67:	0f b7 55 fe          	movzwl -0x2(%ebp),%edx
c0101f6b:	ee                   	out    %al,(%dx)
        outb(IO_PIC2 + 1, mask >> 8);
c0101f6c:	0f b7 45 ec          	movzwl -0x14(%ebp),%eax
c0101f70:	66 c1 e8 08          	shr    $0x8,%ax
c0101f74:	0f b6 c0             	movzbl %al,%eax
c0101f77:	66 c7 45 fa a1 00    	movw   $0xa1,-0x6(%ebp)
c0101f7d:	88 45 f9             	mov    %al,-0x7(%ebp)
c0101f80:	0f b6 45 f9          	movzbl -0x7(%ebp),%eax
c0101f84:	0f b7 55 fa          	movzwl -0x6(%ebp),%edx
c0101f88:	ee                   	out    %al,(%dx)
    }
}
c0101f89:	c9                   	leave  
c0101f8a:	c3                   	ret    

c0101f8b <pic_enable>:

void
pic_enable(unsigned int irq) {
c0101f8b:	55                   	push   %ebp
c0101f8c:	89 e5                	mov    %esp,%ebp
c0101f8e:	83 ec 04             	sub    $0x4,%esp
    pic_setmask(irq_mask & ~(1 << irq));
c0101f91:	8b 45 08             	mov    0x8(%ebp),%eax
c0101f94:	ba 01 00 00 00       	mov    $0x1,%edx
c0101f99:	89 c1                	mov    %eax,%ecx
c0101f9b:	d3 e2                	shl    %cl,%edx
c0101f9d:	89 d0                	mov    %edx,%eax
c0101f9f:	f7 d0                	not    %eax
c0101fa1:	89 c2                	mov    %eax,%edx
c0101fa3:	0f b7 05 70 05 12 c0 	movzwl 0xc0120570,%eax
c0101faa:	21 d0                	and    %edx,%eax
c0101fac:	0f b7 c0             	movzwl %ax,%eax
c0101faf:	89 04 24             	mov    %eax,(%esp)
c0101fb2:	e8 7c ff ff ff       	call   c0101f33 <pic_setmask>
}
c0101fb7:	c9                   	leave  
c0101fb8:	c3                   	ret    

c0101fb9 <pic_init>:

/* pic_init - initialize the 8259A interrupt controllers */
void
pic_init(void) {
c0101fb9:	55                   	push   %ebp
c0101fba:	89 e5                	mov    %esp,%ebp
c0101fbc:	83 ec 44             	sub    $0x44,%esp
    did_init = 1;
c0101fbf:	c7 05 e0 11 12 c0 01 	movl   $0x1,0xc01211e0
c0101fc6:	00 00 00 
c0101fc9:	66 c7 45 fe 21 00    	movw   $0x21,-0x2(%ebp)
c0101fcf:	c6 45 fd ff          	movb   $0xff,-0x3(%ebp)
c0101fd3:	0f b6 45 fd          	movzbl -0x3(%ebp),%eax
c0101fd7:	0f b7 55 fe          	movzwl -0x2(%ebp),%edx
c0101fdb:	ee                   	out    %al,(%dx)
c0101fdc:	66 c7 45 fa a1 00    	movw   $0xa1,-0x6(%ebp)
c0101fe2:	c6 45 f9 ff          	movb   $0xff,-0x7(%ebp)
c0101fe6:	0f b6 45 f9          	movzbl -0x7(%ebp),%eax
c0101fea:	0f b7 55 fa          	movzwl -0x6(%ebp),%edx
c0101fee:	ee                   	out    %al,(%dx)
c0101fef:	66 c7 45 f6 20 00    	movw   $0x20,-0xa(%ebp)
c0101ff5:	c6 45 f5 11          	movb   $0x11,-0xb(%ebp)
c0101ff9:	0f b6 45 f5          	movzbl -0xb(%ebp),%eax
c0101ffd:	0f b7 55 f6          	movzwl -0xa(%ebp),%edx
c0102001:	ee                   	out    %al,(%dx)
c0102002:	66 c7 45 f2 21 00    	movw   $0x21,-0xe(%ebp)
c0102008:	c6 45 f1 20          	movb   $0x20,-0xf(%ebp)
c010200c:	0f b6 45 f1          	movzbl -0xf(%ebp),%eax
c0102010:	0f b7 55 f2          	movzwl -0xe(%ebp),%edx
c0102014:	ee                   	out    %al,(%dx)
c0102015:	66 c7 45 ee 21 00    	movw   $0x21,-0x12(%ebp)
c010201b:	c6 45 ed 04          	movb   $0x4,-0x13(%ebp)
c010201f:	0f b6 45 ed          	movzbl -0x13(%ebp),%eax
c0102023:	0f b7 55 ee          	movzwl -0x12(%ebp),%edx
c0102027:	ee                   	out    %al,(%dx)
c0102028:	66 c7 45 ea 21 00    	movw   $0x21,-0x16(%ebp)
c010202e:	c6 45 e9 03          	movb   $0x3,-0x17(%ebp)
c0102032:	0f b6 45 e9          	movzbl -0x17(%ebp),%eax
c0102036:	0f b7 55 ea          	movzwl -0x16(%ebp),%edx
c010203a:	ee                   	out    %al,(%dx)
c010203b:	66 c7 45 e6 a0 00    	movw   $0xa0,-0x1a(%ebp)
c0102041:	c6 45 e5 11          	movb   $0x11,-0x1b(%ebp)
c0102045:	0f b6 45 e5          	movzbl -0x1b(%ebp),%eax
c0102049:	0f b7 55 e6          	movzwl -0x1a(%ebp),%edx
c010204d:	ee                   	out    %al,(%dx)
c010204e:	66 c7 45 e2 a1 00    	movw   $0xa1,-0x1e(%ebp)
c0102054:	c6 45 e1 28          	movb   $0x28,-0x1f(%ebp)
c0102058:	0f b6 45 e1          	movzbl -0x1f(%ebp),%eax
c010205c:	0f b7 55 e2          	movzwl -0x1e(%ebp),%edx
c0102060:	ee                   	out    %al,(%dx)
c0102061:	66 c7 45 de a1 00    	movw   $0xa1,-0x22(%ebp)
c0102067:	c6 45 dd 02          	movb   $0x2,-0x23(%ebp)
c010206b:	0f b6 45 dd          	movzbl -0x23(%ebp),%eax
c010206f:	0f b7 55 de          	movzwl -0x22(%ebp),%edx
c0102073:	ee                   	out    %al,(%dx)
c0102074:	66 c7 45 da a1 00    	movw   $0xa1,-0x26(%ebp)
c010207a:	c6 45 d9 03          	movb   $0x3,-0x27(%ebp)
c010207e:	0f b6 45 d9          	movzbl -0x27(%ebp),%eax
c0102082:	0f b7 55 da          	movzwl -0x26(%ebp),%edx
c0102086:	ee                   	out    %al,(%dx)
c0102087:	66 c7 45 d6 20 00    	movw   $0x20,-0x2a(%ebp)
c010208d:	c6 45 d5 68          	movb   $0x68,-0x2b(%ebp)
c0102091:	0f b6 45 d5          	movzbl -0x2b(%ebp),%eax
c0102095:	0f b7 55 d6          	movzwl -0x2a(%ebp),%edx
c0102099:	ee                   	out    %al,(%dx)
c010209a:	66 c7 45 d2 20 00    	movw   $0x20,-0x2e(%ebp)
c01020a0:	c6 45 d1 0a          	movb   $0xa,-0x2f(%ebp)
c01020a4:	0f b6 45 d1          	movzbl -0x2f(%ebp),%eax
c01020a8:	0f b7 55 d2          	movzwl -0x2e(%ebp),%edx
c01020ac:	ee                   	out    %al,(%dx)
c01020ad:	66 c7 45 ce a0 00    	movw   $0xa0,-0x32(%ebp)
c01020b3:	c6 45 cd 68          	movb   $0x68,-0x33(%ebp)
c01020b7:	0f b6 45 cd          	movzbl -0x33(%ebp),%eax
c01020bb:	0f b7 55 ce          	movzwl -0x32(%ebp),%edx
c01020bf:	ee                   	out    %al,(%dx)
c01020c0:	66 c7 45 ca a0 00    	movw   $0xa0,-0x36(%ebp)
c01020c6:	c6 45 c9 0a          	movb   $0xa,-0x37(%ebp)
c01020ca:	0f b6 45 c9          	movzbl -0x37(%ebp),%eax
c01020ce:	0f b7 55 ca          	movzwl -0x36(%ebp),%edx
c01020d2:	ee                   	out    %al,(%dx)
    outb(IO_PIC1, 0x0a);    // read IRR by default

    outb(IO_PIC2, 0x68);    // OCW3
    outb(IO_PIC2, 0x0a);    // OCW3

    if (irq_mask != 0xFFFF) {
c01020d3:	0f b7 05 70 05 12 c0 	movzwl 0xc0120570,%eax
c01020da:	66 83 f8 ff          	cmp    $0xffff,%ax
c01020de:	74 12                	je     c01020f2 <pic_init+0x139>
        pic_setmask(irq_mask);
c01020e0:	0f b7 05 70 05 12 c0 	movzwl 0xc0120570,%eax
c01020e7:	0f b7 c0             	movzwl %ax,%eax
c01020ea:	89 04 24             	mov    %eax,(%esp)
c01020ed:	e8 41 fe ff ff       	call   c0101f33 <pic_setmask>
    }
}
c01020f2:	c9                   	leave  
c01020f3:	c3                   	ret    

c01020f4 <print_ticks>:
#include <swap.h>
#include <kdebug.h>
#include <string.h>
#define TICK_NUM 100

static void print_ticks() {
c01020f4:	55                   	push   %ebp
c01020f5:	89 e5                	mov    %esp,%ebp
c01020f7:	83 ec 18             	sub    $0x18,%esp
    cprintf("%d ticks\n",TICK_NUM);
c01020fa:	c7 44 24 04 64 00 00 	movl   $0x64,0x4(%esp)
c0102101:	00 
c0102102:	c7 04 24 40 90 10 c0 	movl   $0xc0109040,(%esp)
c0102109:	e8 3d e2 ff ff       	call   c010034b <cprintf>
#ifdef DEBUG_GRADE
    cprintf("End of Test.\n");
    panic("EOT: kernel seems ok.");
#endif
}
c010210e:	c9                   	leave  
c010210f:	c3                   	ret    

c0102110 <idt_init>:
    sizeof(idt) - 1, (uintptr_t)idt
};

/* idt_init - initialize IDT to each of the entry points in kern/trap/vectors.S */
void
idt_init(void) {
c0102110:	55                   	push   %ebp
c0102111:	89 e5                	mov    %esp,%ebp
c0102113:	83 ec 10             	sub    $0x10,%esp
      *     You don't know the meaning of this instruction? just google it! and check the libs/x86.h to know more.
      *     Notice: the argument of lidt is idt_pd. try to find it!
      */
    extern uintptr_t __vectors[];
    int i;
    for (i = 0; i < sizeof(idt) / sizeof(struct gatedesc); i ++) {
c0102116:	c7 45 fc 00 00 00 00 	movl   $0x0,-0x4(%ebp)
c010211d:	e9 c3 00 00 00       	jmp    c01021e5 <idt_init+0xd5>
        SETGATE(idt[i], 0, GD_KTEXT, __vectors[i], DPL_KERNEL);
c0102122:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0102125:	8b 04 85 00 06 12 c0 	mov    -0x3fedfa00(,%eax,4),%eax
c010212c:	89 c2                	mov    %eax,%edx
c010212e:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0102131:	66 89 14 c5 00 12 12 	mov    %dx,-0x3fedee00(,%eax,8)
c0102138:	c0 
c0102139:	8b 45 fc             	mov    -0x4(%ebp),%eax
c010213c:	66 c7 04 c5 02 12 12 	movw   $0x8,-0x3fededfe(,%eax,8)
c0102143:	c0 08 00 
c0102146:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0102149:	0f b6 14 c5 04 12 12 	movzbl -0x3fededfc(,%eax,8),%edx
c0102150:	c0 
c0102151:	83 e2 e0             	and    $0xffffffe0,%edx
c0102154:	88 14 c5 04 12 12 c0 	mov    %dl,-0x3fededfc(,%eax,8)
c010215b:	8b 45 fc             	mov    -0x4(%ebp),%eax
c010215e:	0f b6 14 c5 04 12 12 	movzbl -0x3fededfc(,%eax,8),%edx
c0102165:	c0 
c0102166:	83 e2 1f             	and    $0x1f,%edx
c0102169:	88 14 c5 04 12 12 c0 	mov    %dl,-0x3fededfc(,%eax,8)
c0102170:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0102173:	0f b6 14 c5 05 12 12 	movzbl -0x3fededfb(,%eax,8),%edx
c010217a:	c0 
c010217b:	83 e2 f0             	and    $0xfffffff0,%edx
c010217e:	83 ca 0e             	or     $0xe,%edx
c0102181:	88 14 c5 05 12 12 c0 	mov    %dl,-0x3fededfb(,%eax,8)
c0102188:	8b 45 fc             	mov    -0x4(%ebp),%eax
c010218b:	0f b6 14 c5 05 12 12 	movzbl -0x3fededfb(,%eax,8),%edx
c0102192:	c0 
c0102193:	83 e2 ef             	and    $0xffffffef,%edx
c0102196:	88 14 c5 05 12 12 c0 	mov    %dl,-0x3fededfb(,%eax,8)
c010219d:	8b 45 fc             	mov    -0x4(%ebp),%eax
c01021a0:	0f b6 14 c5 05 12 12 	movzbl -0x3fededfb(,%eax,8),%edx
c01021a7:	c0 
c01021a8:	83 e2 9f             	and    $0xffffff9f,%edx
c01021ab:	88 14 c5 05 12 12 c0 	mov    %dl,-0x3fededfb(,%eax,8)
c01021b2:	8b 45 fc             	mov    -0x4(%ebp),%eax
c01021b5:	0f b6 14 c5 05 12 12 	movzbl -0x3fededfb(,%eax,8),%edx
c01021bc:	c0 
c01021bd:	83 ca 80             	or     $0xffffff80,%edx
c01021c0:	88 14 c5 05 12 12 c0 	mov    %dl,-0x3fededfb(,%eax,8)
c01021c7:	8b 45 fc             	mov    -0x4(%ebp),%eax
c01021ca:	8b 04 85 00 06 12 c0 	mov    -0x3fedfa00(,%eax,4),%eax
c01021d1:	c1 e8 10             	shr    $0x10,%eax
c01021d4:	89 c2                	mov    %eax,%edx
c01021d6:	8b 45 fc             	mov    -0x4(%ebp),%eax
c01021d9:	66 89 14 c5 06 12 12 	mov    %dx,-0x3fededfa(,%eax,8)
c01021e0:	c0 
      *     You don't know the meaning of this instruction? just google it! and check the libs/x86.h to know more.
      *     Notice: the argument of lidt is idt_pd. try to find it!
      */
    extern uintptr_t __vectors[];
    int i;
    for (i = 0; i < sizeof(idt) / sizeof(struct gatedesc); i ++) {
c01021e1:	83 45 fc 01          	addl   $0x1,-0x4(%ebp)
c01021e5:	8b 45 fc             	mov    -0x4(%ebp),%eax
c01021e8:	3d ff 00 00 00       	cmp    $0xff,%eax
c01021ed:	0f 86 2f ff ff ff    	jbe    c0102122 <idt_init+0x12>
        SETGATE(idt[i], 0, GD_KTEXT, __vectors[i], DPL_KERNEL);
    }
	// set for switch from user to kernel
    SETGATE(idt[T_SWITCH_TOK], 0, GD_KTEXT, __vectors[T_SWITCH_TOK], DPL_USER);
c01021f3:	a1 e4 07 12 c0       	mov    0xc01207e4,%eax
c01021f8:	66 a3 c8 15 12 c0    	mov    %ax,0xc01215c8
c01021fe:	66 c7 05 ca 15 12 c0 	movw   $0x8,0xc01215ca
c0102205:	08 00 
c0102207:	0f b6 05 cc 15 12 c0 	movzbl 0xc01215cc,%eax
c010220e:	83 e0 e0             	and    $0xffffffe0,%eax
c0102211:	a2 cc 15 12 c0       	mov    %al,0xc01215cc
c0102216:	0f b6 05 cc 15 12 c0 	movzbl 0xc01215cc,%eax
c010221d:	83 e0 1f             	and    $0x1f,%eax
c0102220:	a2 cc 15 12 c0       	mov    %al,0xc01215cc
c0102225:	0f b6 05 cd 15 12 c0 	movzbl 0xc01215cd,%eax
c010222c:	83 e0 f0             	and    $0xfffffff0,%eax
c010222f:	83 c8 0e             	or     $0xe,%eax
c0102232:	a2 cd 15 12 c0       	mov    %al,0xc01215cd
c0102237:	0f b6 05 cd 15 12 c0 	movzbl 0xc01215cd,%eax
c010223e:	83 e0 ef             	and    $0xffffffef,%eax
c0102241:	a2 cd 15 12 c0       	mov    %al,0xc01215cd
c0102246:	0f b6 05 cd 15 12 c0 	movzbl 0xc01215cd,%eax
c010224d:	83 c8 60             	or     $0x60,%eax
c0102250:	a2 cd 15 12 c0       	mov    %al,0xc01215cd
c0102255:	0f b6 05 cd 15 12 c0 	movzbl 0xc01215cd,%eax
c010225c:	83 c8 80             	or     $0xffffff80,%eax
c010225f:	a2 cd 15 12 c0       	mov    %al,0xc01215cd
c0102264:	a1 e4 07 12 c0       	mov    0xc01207e4,%eax
c0102269:	c1 e8 10             	shr    $0x10,%eax
c010226c:	66 a3 ce 15 12 c0    	mov    %ax,0xc01215ce
c0102272:	c7 45 f8 80 05 12 c0 	movl   $0xc0120580,-0x8(%ebp)
    }
}

static inline void
lidt(struct pseudodesc *pd) {
    asm volatile ("lidt (%0)" :: "r" (pd) : "memory");
c0102279:	8b 45 f8             	mov    -0x8(%ebp),%eax
c010227c:	0f 01 18             	lidtl  (%eax)
	// load the IDT
    lidt(&idt_pd);
}
c010227f:	c9                   	leave  
c0102280:	c3                   	ret    

c0102281 <trapname>:

static const char *
trapname(int trapno) {
c0102281:	55                   	push   %ebp
c0102282:	89 e5                	mov    %esp,%ebp
        "Alignment Check",
        "Machine-Check",
        "SIMD Floating-Point Exception"
    };

    if (trapno < sizeof(excnames)/sizeof(const char * const)) {
c0102284:	8b 45 08             	mov    0x8(%ebp),%eax
c0102287:	83 f8 13             	cmp    $0x13,%eax
c010228a:	77 0c                	ja     c0102298 <trapname+0x17>
        return excnames[trapno];
c010228c:	8b 45 08             	mov    0x8(%ebp),%eax
c010228f:	8b 04 85 20 94 10 c0 	mov    -0x3fef6be0(,%eax,4),%eax
c0102296:	eb 18                	jmp    c01022b0 <trapname+0x2f>
    }
    if (trapno >= IRQ_OFFSET && trapno < IRQ_OFFSET + 16) {
c0102298:	83 7d 08 1f          	cmpl   $0x1f,0x8(%ebp)
c010229c:	7e 0d                	jle    c01022ab <trapname+0x2a>
c010229e:	83 7d 08 2f          	cmpl   $0x2f,0x8(%ebp)
c01022a2:	7f 07                	jg     c01022ab <trapname+0x2a>
        return "Hardware Interrupt";
c01022a4:	b8 4a 90 10 c0       	mov    $0xc010904a,%eax
c01022a9:	eb 05                	jmp    c01022b0 <trapname+0x2f>
    }
    return "(unknown trap)";
c01022ab:	b8 5d 90 10 c0       	mov    $0xc010905d,%eax
}
c01022b0:	5d                   	pop    %ebp
c01022b1:	c3                   	ret    

c01022b2 <trap_in_kernel>:

/* trap_in_kernel - test if trap happened in kernel */
bool
trap_in_kernel(struct trapframe *tf) {
c01022b2:	55                   	push   %ebp
c01022b3:	89 e5                	mov    %esp,%ebp
    return (tf->tf_cs == (uint16_t)KERNEL_CS);
c01022b5:	8b 45 08             	mov    0x8(%ebp),%eax
c01022b8:	0f b7 40 3c          	movzwl 0x3c(%eax),%eax
c01022bc:	66 83 f8 08          	cmp    $0x8,%ax
c01022c0:	0f 94 c0             	sete   %al
c01022c3:	0f b6 c0             	movzbl %al,%eax
}
c01022c6:	5d                   	pop    %ebp
c01022c7:	c3                   	ret    

c01022c8 <print_trapframe>:
    "TF", "IF", "DF", "OF", NULL, NULL, "NT", NULL,
    "RF", "VM", "AC", "VIF", "VIP", "ID", NULL, NULL,
};

void
print_trapframe(struct trapframe *tf) {
c01022c8:	55                   	push   %ebp
c01022c9:	89 e5                	mov    %esp,%ebp
c01022cb:	83 ec 28             	sub    $0x28,%esp
    cprintf("trapframe at %p\n", tf);
c01022ce:	8b 45 08             	mov    0x8(%ebp),%eax
c01022d1:	89 44 24 04          	mov    %eax,0x4(%esp)
c01022d5:	c7 04 24 9e 90 10 c0 	movl   $0xc010909e,(%esp)
c01022dc:	e8 6a e0 ff ff       	call   c010034b <cprintf>
    print_regs(&tf->tf_regs);
c01022e1:	8b 45 08             	mov    0x8(%ebp),%eax
c01022e4:	89 04 24             	mov    %eax,(%esp)
c01022e7:	e8 a1 01 00 00       	call   c010248d <print_regs>
    cprintf("  ds   0x----%04x\n", tf->tf_ds);
c01022ec:	8b 45 08             	mov    0x8(%ebp),%eax
c01022ef:	0f b7 40 2c          	movzwl 0x2c(%eax),%eax
c01022f3:	0f b7 c0             	movzwl %ax,%eax
c01022f6:	89 44 24 04          	mov    %eax,0x4(%esp)
c01022fa:	c7 04 24 af 90 10 c0 	movl   $0xc01090af,(%esp)
c0102301:	e8 45 e0 ff ff       	call   c010034b <cprintf>
    cprintf("  es   0x----%04x\n", tf->tf_es);
c0102306:	8b 45 08             	mov    0x8(%ebp),%eax
c0102309:	0f b7 40 28          	movzwl 0x28(%eax),%eax
c010230d:	0f b7 c0             	movzwl %ax,%eax
c0102310:	89 44 24 04          	mov    %eax,0x4(%esp)
c0102314:	c7 04 24 c2 90 10 c0 	movl   $0xc01090c2,(%esp)
c010231b:	e8 2b e0 ff ff       	call   c010034b <cprintf>
    cprintf("  fs   0x----%04x\n", tf->tf_fs);
c0102320:	8b 45 08             	mov    0x8(%ebp),%eax
c0102323:	0f b7 40 24          	movzwl 0x24(%eax),%eax
c0102327:	0f b7 c0             	movzwl %ax,%eax
c010232a:	89 44 24 04          	mov    %eax,0x4(%esp)
c010232e:	c7 04 24 d5 90 10 c0 	movl   $0xc01090d5,(%esp)
c0102335:	e8 11 e0 ff ff       	call   c010034b <cprintf>
    cprintf("  gs   0x----%04x\n", tf->tf_gs);
c010233a:	8b 45 08             	mov    0x8(%ebp),%eax
c010233d:	0f b7 40 20          	movzwl 0x20(%eax),%eax
c0102341:	0f b7 c0             	movzwl %ax,%eax
c0102344:	89 44 24 04          	mov    %eax,0x4(%esp)
c0102348:	c7 04 24 e8 90 10 c0 	movl   $0xc01090e8,(%esp)
c010234f:	e8 f7 df ff ff       	call   c010034b <cprintf>
    cprintf("  trap 0x%08x %s\n", tf->tf_trapno, trapname(tf->tf_trapno));
c0102354:	8b 45 08             	mov    0x8(%ebp),%eax
c0102357:	8b 40 30             	mov    0x30(%eax),%eax
c010235a:	89 04 24             	mov    %eax,(%esp)
c010235d:	e8 1f ff ff ff       	call   c0102281 <trapname>
c0102362:	8b 55 08             	mov    0x8(%ebp),%edx
c0102365:	8b 52 30             	mov    0x30(%edx),%edx
c0102368:	89 44 24 08          	mov    %eax,0x8(%esp)
c010236c:	89 54 24 04          	mov    %edx,0x4(%esp)
c0102370:	c7 04 24 fb 90 10 c0 	movl   $0xc01090fb,(%esp)
c0102377:	e8 cf df ff ff       	call   c010034b <cprintf>
    cprintf("  err  0x%08x\n", tf->tf_err);
c010237c:	8b 45 08             	mov    0x8(%ebp),%eax
c010237f:	8b 40 34             	mov    0x34(%eax),%eax
c0102382:	89 44 24 04          	mov    %eax,0x4(%esp)
c0102386:	c7 04 24 0d 91 10 c0 	movl   $0xc010910d,(%esp)
c010238d:	e8 b9 df ff ff       	call   c010034b <cprintf>
    cprintf("  eip  0x%08x\n", tf->tf_eip);
c0102392:	8b 45 08             	mov    0x8(%ebp),%eax
c0102395:	8b 40 38             	mov    0x38(%eax),%eax
c0102398:	89 44 24 04          	mov    %eax,0x4(%esp)
c010239c:	c7 04 24 1c 91 10 c0 	movl   $0xc010911c,(%esp)
c01023a3:	e8 a3 df ff ff       	call   c010034b <cprintf>
    cprintf("  cs   0x----%04x\n", tf->tf_cs);
c01023a8:	8b 45 08             	mov    0x8(%ebp),%eax
c01023ab:	0f b7 40 3c          	movzwl 0x3c(%eax),%eax
c01023af:	0f b7 c0             	movzwl %ax,%eax
c01023b2:	89 44 24 04          	mov    %eax,0x4(%esp)
c01023b6:	c7 04 24 2b 91 10 c0 	movl   $0xc010912b,(%esp)
c01023bd:	e8 89 df ff ff       	call   c010034b <cprintf>
    cprintf("  flag 0x%08x ", tf->tf_eflags);
c01023c2:	8b 45 08             	mov    0x8(%ebp),%eax
c01023c5:	8b 40 40             	mov    0x40(%eax),%eax
c01023c8:	89 44 24 04          	mov    %eax,0x4(%esp)
c01023cc:	c7 04 24 3e 91 10 c0 	movl   $0xc010913e,(%esp)
c01023d3:	e8 73 df ff ff       	call   c010034b <cprintf>

    int i, j;
    for (i = 0, j = 1; i < sizeof(IA32flags) / sizeof(IA32flags[0]); i ++, j <<= 1) {
c01023d8:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
c01023df:	c7 45 f0 01 00 00 00 	movl   $0x1,-0x10(%ebp)
c01023e6:	eb 3e                	jmp    c0102426 <print_trapframe+0x15e>
        if ((tf->tf_eflags & j) && IA32flags[i] != NULL) {
c01023e8:	8b 45 08             	mov    0x8(%ebp),%eax
c01023eb:	8b 50 40             	mov    0x40(%eax),%edx
c01023ee:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01023f1:	21 d0                	and    %edx,%eax
c01023f3:	85 c0                	test   %eax,%eax
c01023f5:	74 28                	je     c010241f <print_trapframe+0x157>
c01023f7:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01023fa:	8b 04 85 a0 05 12 c0 	mov    -0x3fedfa60(,%eax,4),%eax
c0102401:	85 c0                	test   %eax,%eax
c0102403:	74 1a                	je     c010241f <print_trapframe+0x157>
            cprintf("%s,", IA32flags[i]);
c0102405:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0102408:	8b 04 85 a0 05 12 c0 	mov    -0x3fedfa60(,%eax,4),%eax
c010240f:	89 44 24 04          	mov    %eax,0x4(%esp)
c0102413:	c7 04 24 4d 91 10 c0 	movl   $0xc010914d,(%esp)
c010241a:	e8 2c df ff ff       	call   c010034b <cprintf>
    cprintf("  eip  0x%08x\n", tf->tf_eip);
    cprintf("  cs   0x----%04x\n", tf->tf_cs);
    cprintf("  flag 0x%08x ", tf->tf_eflags);

    int i, j;
    for (i = 0, j = 1; i < sizeof(IA32flags) / sizeof(IA32flags[0]); i ++, j <<= 1) {
c010241f:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
c0102423:	d1 65 f0             	shll   -0x10(%ebp)
c0102426:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0102429:	83 f8 17             	cmp    $0x17,%eax
c010242c:	76 ba                	jbe    c01023e8 <print_trapframe+0x120>
        if ((tf->tf_eflags & j) && IA32flags[i] != NULL) {
            cprintf("%s,", IA32flags[i]);
        }
    }
    cprintf("IOPL=%d\n", (tf->tf_eflags & FL_IOPL_MASK) >> 12);
c010242e:	8b 45 08             	mov    0x8(%ebp),%eax
c0102431:	8b 40 40             	mov    0x40(%eax),%eax
c0102434:	25 00 30 00 00       	and    $0x3000,%eax
c0102439:	c1 e8 0c             	shr    $0xc,%eax
c010243c:	89 44 24 04          	mov    %eax,0x4(%esp)
c0102440:	c7 04 24 51 91 10 c0 	movl   $0xc0109151,(%esp)
c0102447:	e8 ff de ff ff       	call   c010034b <cprintf>

    if (!trap_in_kernel(tf)) {
c010244c:	8b 45 08             	mov    0x8(%ebp),%eax
c010244f:	89 04 24             	mov    %eax,(%esp)
c0102452:	e8 5b fe ff ff       	call   c01022b2 <trap_in_kernel>
c0102457:	85 c0                	test   %eax,%eax
c0102459:	75 30                	jne    c010248b <print_trapframe+0x1c3>
        cprintf("  esp  0x%08x\n", tf->tf_esp);
c010245b:	8b 45 08             	mov    0x8(%ebp),%eax
c010245e:	8b 40 44             	mov    0x44(%eax),%eax
c0102461:	89 44 24 04          	mov    %eax,0x4(%esp)
c0102465:	c7 04 24 5a 91 10 c0 	movl   $0xc010915a,(%esp)
c010246c:	e8 da de ff ff       	call   c010034b <cprintf>
        cprintf("  ss   0x----%04x\n", tf->tf_ss);
c0102471:	8b 45 08             	mov    0x8(%ebp),%eax
c0102474:	0f b7 40 48          	movzwl 0x48(%eax),%eax
c0102478:	0f b7 c0             	movzwl %ax,%eax
c010247b:	89 44 24 04          	mov    %eax,0x4(%esp)
c010247f:	c7 04 24 69 91 10 c0 	movl   $0xc0109169,(%esp)
c0102486:	e8 c0 de ff ff       	call   c010034b <cprintf>
    }
}
c010248b:	c9                   	leave  
c010248c:	c3                   	ret    

c010248d <print_regs>:

void
print_regs(struct pushregs *regs) {
c010248d:	55                   	push   %ebp
c010248e:	89 e5                	mov    %esp,%ebp
c0102490:	83 ec 18             	sub    $0x18,%esp
    cprintf("  edi  0x%08x\n", regs->reg_edi);
c0102493:	8b 45 08             	mov    0x8(%ebp),%eax
c0102496:	8b 00                	mov    (%eax),%eax
c0102498:	89 44 24 04          	mov    %eax,0x4(%esp)
c010249c:	c7 04 24 7c 91 10 c0 	movl   $0xc010917c,(%esp)
c01024a3:	e8 a3 de ff ff       	call   c010034b <cprintf>
    cprintf("  esi  0x%08x\n", regs->reg_esi);
c01024a8:	8b 45 08             	mov    0x8(%ebp),%eax
c01024ab:	8b 40 04             	mov    0x4(%eax),%eax
c01024ae:	89 44 24 04          	mov    %eax,0x4(%esp)
c01024b2:	c7 04 24 8b 91 10 c0 	movl   $0xc010918b,(%esp)
c01024b9:	e8 8d de ff ff       	call   c010034b <cprintf>
    cprintf("  ebp  0x%08x\n", regs->reg_ebp);
c01024be:	8b 45 08             	mov    0x8(%ebp),%eax
c01024c1:	8b 40 08             	mov    0x8(%eax),%eax
c01024c4:	89 44 24 04          	mov    %eax,0x4(%esp)
c01024c8:	c7 04 24 9a 91 10 c0 	movl   $0xc010919a,(%esp)
c01024cf:	e8 77 de ff ff       	call   c010034b <cprintf>
    cprintf("  oesp 0x%08x\n", regs->reg_oesp);
c01024d4:	8b 45 08             	mov    0x8(%ebp),%eax
c01024d7:	8b 40 0c             	mov    0xc(%eax),%eax
c01024da:	89 44 24 04          	mov    %eax,0x4(%esp)
c01024de:	c7 04 24 a9 91 10 c0 	movl   $0xc01091a9,(%esp)
c01024e5:	e8 61 de ff ff       	call   c010034b <cprintf>
    cprintf("  ebx  0x%08x\n", regs->reg_ebx);
c01024ea:	8b 45 08             	mov    0x8(%ebp),%eax
c01024ed:	8b 40 10             	mov    0x10(%eax),%eax
c01024f0:	89 44 24 04          	mov    %eax,0x4(%esp)
c01024f4:	c7 04 24 b8 91 10 c0 	movl   $0xc01091b8,(%esp)
c01024fb:	e8 4b de ff ff       	call   c010034b <cprintf>
    cprintf("  edx  0x%08x\n", regs->reg_edx);
c0102500:	8b 45 08             	mov    0x8(%ebp),%eax
c0102503:	8b 40 14             	mov    0x14(%eax),%eax
c0102506:	89 44 24 04          	mov    %eax,0x4(%esp)
c010250a:	c7 04 24 c7 91 10 c0 	movl   $0xc01091c7,(%esp)
c0102511:	e8 35 de ff ff       	call   c010034b <cprintf>
    cprintf("  ecx  0x%08x\n", regs->reg_ecx);
c0102516:	8b 45 08             	mov    0x8(%ebp),%eax
c0102519:	8b 40 18             	mov    0x18(%eax),%eax
c010251c:	89 44 24 04          	mov    %eax,0x4(%esp)
c0102520:	c7 04 24 d6 91 10 c0 	movl   $0xc01091d6,(%esp)
c0102527:	e8 1f de ff ff       	call   c010034b <cprintf>
    cprintf("  eax  0x%08x\n", regs->reg_eax);
c010252c:	8b 45 08             	mov    0x8(%ebp),%eax
c010252f:	8b 40 1c             	mov    0x1c(%eax),%eax
c0102532:	89 44 24 04          	mov    %eax,0x4(%esp)
c0102536:	c7 04 24 e5 91 10 c0 	movl   $0xc01091e5,(%esp)
c010253d:	e8 09 de ff ff       	call   c010034b <cprintf>
}
c0102542:	c9                   	leave  
c0102543:	c3                   	ret    

c0102544 <print_pgfault>:

static inline void
print_pgfault(struct trapframe *tf) {
c0102544:	55                   	push   %ebp
c0102545:	89 e5                	mov    %esp,%ebp
c0102547:	53                   	push   %ebx
c0102548:	83 ec 34             	sub    $0x34,%esp
     * bit 2 == 0 means kernel, 1 means user
     * */
    cprintf("page fault at 0x%08x: %c/%c [%s].\n", rcr2(),
            (tf->tf_err & 4) ? 'U' : 'K',
            (tf->tf_err & 2) ? 'W' : 'R',
            (tf->tf_err & 1) ? "protection fault" : "no page found");
c010254b:	8b 45 08             	mov    0x8(%ebp),%eax
c010254e:	8b 40 34             	mov    0x34(%eax),%eax
c0102551:	83 e0 01             	and    $0x1,%eax
    /* error_code:
     * bit 0 == 0 means no page found, 1 means protection fault
     * bit 1 == 0 means read, 1 means write
     * bit 2 == 0 means kernel, 1 means user
     * */
    cprintf("page fault at 0x%08x: %c/%c [%s].\n", rcr2(),
c0102554:	85 c0                	test   %eax,%eax
c0102556:	74 07                	je     c010255f <print_pgfault+0x1b>
c0102558:	b9 f4 91 10 c0       	mov    $0xc01091f4,%ecx
c010255d:	eb 05                	jmp    c0102564 <print_pgfault+0x20>
c010255f:	b9 05 92 10 c0       	mov    $0xc0109205,%ecx
            (tf->tf_err & 4) ? 'U' : 'K',
            (tf->tf_err & 2) ? 'W' : 'R',
c0102564:	8b 45 08             	mov    0x8(%ebp),%eax
c0102567:	8b 40 34             	mov    0x34(%eax),%eax
c010256a:	83 e0 02             	and    $0x2,%eax
    /* error_code:
     * bit 0 == 0 means no page found, 1 means protection fault
     * bit 1 == 0 means read, 1 means write
     * bit 2 == 0 means kernel, 1 means user
     * */
    cprintf("page fault at 0x%08x: %c/%c [%s].\n", rcr2(),
c010256d:	85 c0                	test   %eax,%eax
c010256f:	74 07                	je     c0102578 <print_pgfault+0x34>
c0102571:	ba 57 00 00 00       	mov    $0x57,%edx
c0102576:	eb 05                	jmp    c010257d <print_pgfault+0x39>
c0102578:	ba 52 00 00 00       	mov    $0x52,%edx
            (tf->tf_err & 4) ? 'U' : 'K',
c010257d:	8b 45 08             	mov    0x8(%ebp),%eax
c0102580:	8b 40 34             	mov    0x34(%eax),%eax
c0102583:	83 e0 04             	and    $0x4,%eax
    /* error_code:
     * bit 0 == 0 means no page found, 1 means protection fault
     * bit 1 == 0 means read, 1 means write
     * bit 2 == 0 means kernel, 1 means user
     * */
    cprintf("page fault at 0x%08x: %c/%c [%s].\n", rcr2(),
c0102586:	85 c0                	test   %eax,%eax
c0102588:	74 07                	je     c0102591 <print_pgfault+0x4d>
c010258a:	b8 55 00 00 00       	mov    $0x55,%eax
c010258f:	eb 05                	jmp    c0102596 <print_pgfault+0x52>
c0102591:	b8 4b 00 00 00       	mov    $0x4b,%eax
}

static inline uintptr_t
rcr2(void) {
    uintptr_t cr2;
    asm volatile ("mov %%cr2, %0" : "=r" (cr2) :: "memory");
c0102596:	0f 20 d3             	mov    %cr2,%ebx
c0102599:	89 5d f4             	mov    %ebx,-0xc(%ebp)
    return cr2;
c010259c:	8b 5d f4             	mov    -0xc(%ebp),%ebx
c010259f:	89 4c 24 10          	mov    %ecx,0x10(%esp)
c01025a3:	89 54 24 0c          	mov    %edx,0xc(%esp)
c01025a7:	89 44 24 08          	mov    %eax,0x8(%esp)
c01025ab:	89 5c 24 04          	mov    %ebx,0x4(%esp)
c01025af:	c7 04 24 14 92 10 c0 	movl   $0xc0109214,(%esp)
c01025b6:	e8 90 dd ff ff       	call   c010034b <cprintf>
            (tf->tf_err & 4) ? 'U' : 'K',
            (tf->tf_err & 2) ? 'W' : 'R',
            (tf->tf_err & 1) ? "protection fault" : "no page found");
}
c01025bb:	83 c4 34             	add    $0x34,%esp
c01025be:	5b                   	pop    %ebx
c01025bf:	5d                   	pop    %ebp
c01025c0:	c3                   	ret    

c01025c1 <pgfault_handler>:

static int
pgfault_handler(struct trapframe *tf) {
c01025c1:	55                   	push   %ebp
c01025c2:	89 e5                	mov    %esp,%ebp
c01025c4:	83 ec 28             	sub    $0x28,%esp
    extern struct mm_struct *check_mm_struct;
    print_pgfault(tf);
c01025c7:	8b 45 08             	mov    0x8(%ebp),%eax
c01025ca:	89 04 24             	mov    %eax,(%esp)
c01025cd:	e8 72 ff ff ff       	call   c0102544 <print_pgfault>
    if (check_mm_struct != NULL) {
c01025d2:	a1 ac 1b 12 c0       	mov    0xc0121bac,%eax
c01025d7:	85 c0                	test   %eax,%eax
c01025d9:	74 28                	je     c0102603 <pgfault_handler+0x42>
}

static inline uintptr_t
rcr2(void) {
    uintptr_t cr2;
    asm volatile ("mov %%cr2, %0" : "=r" (cr2) :: "memory");
c01025db:	0f 20 d0             	mov    %cr2,%eax
c01025de:	89 45 f4             	mov    %eax,-0xc(%ebp)
    return cr2;
c01025e1:	8b 45 f4             	mov    -0xc(%ebp),%eax
        return do_pgfault(check_mm_struct, tf->tf_err, rcr2());
c01025e4:	89 c1                	mov    %eax,%ecx
c01025e6:	8b 45 08             	mov    0x8(%ebp),%eax
c01025e9:	8b 50 34             	mov    0x34(%eax),%edx
c01025ec:	a1 ac 1b 12 c0       	mov    0xc0121bac,%eax
c01025f1:	89 4c 24 08          	mov    %ecx,0x8(%esp)
c01025f5:	89 54 24 04          	mov    %edx,0x4(%esp)
c01025f9:	89 04 24             	mov    %eax,(%esp)
c01025fc:	e8 14 56 00 00       	call   c0107c15 <do_pgfault>
c0102601:	eb 1c                	jmp    c010261f <pgfault_handler+0x5e>
    }
    panic("unhandled page fault.\n");
c0102603:	c7 44 24 08 37 92 10 	movl   $0xc0109237,0x8(%esp)
c010260a:	c0 
c010260b:	c7 44 24 04 a8 00 00 	movl   $0xa8,0x4(%esp)
c0102612:	00 
c0102613:	c7 04 24 4e 92 10 c0 	movl   $0xc010924e,(%esp)
c010261a:	e8 b6 e6 ff ff       	call   c0100cd5 <__panic>
}
c010261f:	c9                   	leave  
c0102620:	c3                   	ret    

c0102621 <trap_dispatch>:

static volatile int in_swap_tick_event = 0;
extern struct mm_struct *check_mm_struct;

static void
trap_dispatch(struct trapframe *tf) {
c0102621:	55                   	push   %ebp
c0102622:	89 e5                	mov    %esp,%ebp
c0102624:	83 ec 28             	sub    $0x28,%esp
    char c;

    int ret;

    switch (tf->tf_trapno) {
c0102627:	8b 45 08             	mov    0x8(%ebp),%eax
c010262a:	8b 40 30             	mov    0x30(%eax),%eax
c010262d:	83 f8 24             	cmp    $0x24,%eax
c0102630:	0f 84 c2 00 00 00    	je     c01026f8 <trap_dispatch+0xd7>
c0102636:	83 f8 24             	cmp    $0x24,%eax
c0102639:	77 18                	ja     c0102653 <trap_dispatch+0x32>
c010263b:	83 f8 20             	cmp    $0x20,%eax
c010263e:	74 7d                	je     c01026bd <trap_dispatch+0x9c>
c0102640:	83 f8 21             	cmp    $0x21,%eax
c0102643:	0f 84 d5 00 00 00    	je     c010271e <trap_dispatch+0xfd>
c0102649:	83 f8 0e             	cmp    $0xe,%eax
c010264c:	74 28                	je     c0102676 <trap_dispatch+0x55>
c010264e:	e9 0d 01 00 00       	jmp    c0102760 <trap_dispatch+0x13f>
c0102653:	83 f8 2e             	cmp    $0x2e,%eax
c0102656:	0f 82 04 01 00 00    	jb     c0102760 <trap_dispatch+0x13f>
c010265c:	83 f8 2f             	cmp    $0x2f,%eax
c010265f:	0f 86 33 01 00 00    	jbe    c0102798 <trap_dispatch+0x177>
c0102665:	83 e8 78             	sub    $0x78,%eax
c0102668:	83 f8 01             	cmp    $0x1,%eax
c010266b:	0f 87 ef 00 00 00    	ja     c0102760 <trap_dispatch+0x13f>
c0102671:	e9 ce 00 00 00       	jmp    c0102744 <trap_dispatch+0x123>
    case T_PGFLT:  //page fault
        if ((ret = pgfault_handler(tf)) != 0) {
c0102676:	8b 45 08             	mov    0x8(%ebp),%eax
c0102679:	89 04 24             	mov    %eax,(%esp)
c010267c:	e8 40 ff ff ff       	call   c01025c1 <pgfault_handler>
c0102681:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0102684:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0102688:	74 2e                	je     c01026b8 <trap_dispatch+0x97>
            print_trapframe(tf);
c010268a:	8b 45 08             	mov    0x8(%ebp),%eax
c010268d:	89 04 24             	mov    %eax,(%esp)
c0102690:	e8 33 fc ff ff       	call   c01022c8 <print_trapframe>
            panic("handle pgfault failed. %e\n", ret);
c0102695:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0102698:	89 44 24 0c          	mov    %eax,0xc(%esp)
c010269c:	c7 44 24 08 5f 92 10 	movl   $0xc010925f,0x8(%esp)
c01026a3:	c0 
c01026a4:	c7 44 24 04 b8 00 00 	movl   $0xb8,0x4(%esp)
c01026ab:	00 
c01026ac:	c7 04 24 4e 92 10 c0 	movl   $0xc010924e,(%esp)
c01026b3:	e8 1d e6 ff ff       	call   c0100cd5 <__panic>
        }
        break;
c01026b8:	e9 dc 00 00 00       	jmp    c0102799 <trap_dispatch+0x178>
        /* handle the timer interrupt */
        /* (1) After a timer interrupt, you should record this event using a global variable (increase it), such as ticks in kern/driver/clock.c
         * (2) Every TICK_NUM cycle, you can print some info using a funciton, such as print_ticks().
         * (3) Too Simple? Yes, I think so!
         */
        ticks ++;
c01026bd:	a1 bc 1a 12 c0       	mov    0xc0121abc,%eax
c01026c2:	83 c0 01             	add    $0x1,%eax
c01026c5:	a3 bc 1a 12 c0       	mov    %eax,0xc0121abc
        if (ticks % TICK_NUM == 0) {
c01026ca:	8b 0d bc 1a 12 c0    	mov    0xc0121abc,%ecx
c01026d0:	ba 1f 85 eb 51       	mov    $0x51eb851f,%edx
c01026d5:	89 c8                	mov    %ecx,%eax
c01026d7:	f7 e2                	mul    %edx
c01026d9:	89 d0                	mov    %edx,%eax
c01026db:	c1 e8 05             	shr    $0x5,%eax
c01026de:	6b c0 64             	imul   $0x64,%eax,%eax
c01026e1:	29 c1                	sub    %eax,%ecx
c01026e3:	89 c8                	mov    %ecx,%eax
c01026e5:	85 c0                	test   %eax,%eax
c01026e7:	75 0a                	jne    c01026f3 <trap_dispatch+0xd2>
            print_ticks();
c01026e9:	e8 06 fa ff ff       	call   c01020f4 <print_ticks>
        }
        break;
c01026ee:	e9 a6 00 00 00       	jmp    c0102799 <trap_dispatch+0x178>
c01026f3:	e9 a1 00 00 00       	jmp    c0102799 <trap_dispatch+0x178>
    case IRQ_OFFSET + IRQ_COM1:
        c = cons_getc();
c01026f8:	e8 46 ef ff ff       	call   c0101643 <cons_getc>
c01026fd:	88 45 f3             	mov    %al,-0xd(%ebp)
        cprintf("serial [%03d] %c\n", c, c);
c0102700:	0f be 55 f3          	movsbl -0xd(%ebp),%edx
c0102704:	0f be 45 f3          	movsbl -0xd(%ebp),%eax
c0102708:	89 54 24 08          	mov    %edx,0x8(%esp)
c010270c:	89 44 24 04          	mov    %eax,0x4(%esp)
c0102710:	c7 04 24 7a 92 10 c0 	movl   $0xc010927a,(%esp)
c0102717:	e8 2f dc ff ff       	call   c010034b <cprintf>
        break;
c010271c:	eb 7b                	jmp    c0102799 <trap_dispatch+0x178>
    case IRQ_OFFSET + IRQ_KBD:
        c = cons_getc();
c010271e:	e8 20 ef ff ff       	call   c0101643 <cons_getc>
c0102723:	88 45 f3             	mov    %al,-0xd(%ebp)
        cprintf("kbd [%03d] %c\n", c, c);
c0102726:	0f be 55 f3          	movsbl -0xd(%ebp),%edx
c010272a:	0f be 45 f3          	movsbl -0xd(%ebp),%eax
c010272e:	89 54 24 08          	mov    %edx,0x8(%esp)
c0102732:	89 44 24 04          	mov    %eax,0x4(%esp)
c0102736:	c7 04 24 8c 92 10 c0 	movl   $0xc010928c,(%esp)
c010273d:	e8 09 dc ff ff       	call   c010034b <cprintf>
        break;
c0102742:	eb 55                	jmp    c0102799 <trap_dispatch+0x178>
    //LAB1 CHALLENGE 1 : YOUR CODE you should modify below codes.
    case T_SWITCH_TOU:
    case T_SWITCH_TOK:
        panic("T_SWITCH_** ??\n");
c0102744:	c7 44 24 08 9b 92 10 	movl   $0xc010929b,0x8(%esp)
c010274b:	c0 
c010274c:	c7 44 24 04 d6 00 00 	movl   $0xd6,0x4(%esp)
c0102753:	00 
c0102754:	c7 04 24 4e 92 10 c0 	movl   $0xc010924e,(%esp)
c010275b:	e8 75 e5 ff ff       	call   c0100cd5 <__panic>
    case IRQ_OFFSET + IRQ_IDE2:
        /* do nothing */
        break;
    default:
        // in kernel, it must be a mistake
        if ((tf->tf_cs & 3) == 0) {
c0102760:	8b 45 08             	mov    0x8(%ebp),%eax
c0102763:	0f b7 40 3c          	movzwl 0x3c(%eax),%eax
c0102767:	0f b7 c0             	movzwl %ax,%eax
c010276a:	83 e0 03             	and    $0x3,%eax
c010276d:	85 c0                	test   %eax,%eax
c010276f:	75 28                	jne    c0102799 <trap_dispatch+0x178>
            print_trapframe(tf);
c0102771:	8b 45 08             	mov    0x8(%ebp),%eax
c0102774:	89 04 24             	mov    %eax,(%esp)
c0102777:	e8 4c fb ff ff       	call   c01022c8 <print_trapframe>
            panic("unexpected trap in kernel.\n");
c010277c:	c7 44 24 08 ab 92 10 	movl   $0xc01092ab,0x8(%esp)
c0102783:	c0 
c0102784:	c7 44 24 04 e0 00 00 	movl   $0xe0,0x4(%esp)
c010278b:	00 
c010278c:	c7 04 24 4e 92 10 c0 	movl   $0xc010924e,(%esp)
c0102793:	e8 3d e5 ff ff       	call   c0100cd5 <__panic>
        panic("T_SWITCH_** ??\n");
        break;
    case IRQ_OFFSET + IRQ_IDE1:
    case IRQ_OFFSET + IRQ_IDE2:
        /* do nothing */
        break;
c0102798:	90                   	nop
        if ((tf->tf_cs & 3) == 0) {
            print_trapframe(tf);
            panic("unexpected trap in kernel.\n");
        }
    }
}
c0102799:	c9                   	leave  
c010279a:	c3                   	ret    

c010279b <trap>:
 * trap - handles or dispatches an exception/interrupt. if and when trap() returns,
 * the code in kern/trap/trapentry.S restores the old CPU state saved in the
 * trapframe and then uses the iret instruction to return from the exception.
 * */
void
trap(struct trapframe *tf) {
c010279b:	55                   	push   %ebp
c010279c:	89 e5                	mov    %esp,%ebp
c010279e:	83 ec 18             	sub    $0x18,%esp
    // dispatch based on what type of trap occurred
    trap_dispatch(tf);
c01027a1:	8b 45 08             	mov    0x8(%ebp),%eax
c01027a4:	89 04 24             	mov    %eax,(%esp)
c01027a7:	e8 75 fe ff ff       	call   c0102621 <trap_dispatch>
}
c01027ac:	c9                   	leave  
c01027ad:	c3                   	ret    

c01027ae <__alltraps>:
.text
.globl __alltraps
__alltraps:
    # push registers to build a trap frame
    # therefore make the stack look like a struct trapframe
    pushl %ds
c01027ae:	1e                   	push   %ds
    pushl %es
c01027af:	06                   	push   %es
    pushl %fs
c01027b0:	0f a0                	push   %fs
    pushl %gs
c01027b2:	0f a8                	push   %gs
    pushal
c01027b4:	60                   	pusha  

    # load GD_KDATA into %ds and %es to set up data segments for kernel
    movl $GD_KDATA, %eax
c01027b5:	b8 10 00 00 00       	mov    $0x10,%eax
    movw %ax, %ds
c01027ba:	8e d8                	mov    %eax,%ds
    movw %ax, %es
c01027bc:	8e c0                	mov    %eax,%es

    # push %esp to pass a pointer to the trapframe as an argument to trap()
    pushl %esp
c01027be:	54                   	push   %esp

    # call trap(tf), where tf=%esp
    call trap
c01027bf:	e8 d7 ff ff ff       	call   c010279b <trap>

    # pop the pushed stack pointer
    popl %esp
c01027c4:	5c                   	pop    %esp

c01027c5 <__trapret>:

    # return falls through to trapret...
.globl __trapret
__trapret:
    # restore registers from stack
    popal
c01027c5:	61                   	popa   

    # restore %ds, %es, %fs and %gs
    popl %gs
c01027c6:	0f a9                	pop    %gs
    popl %fs
c01027c8:	0f a1                	pop    %fs
    popl %es
c01027ca:	07                   	pop    %es
    popl %ds
c01027cb:	1f                   	pop    %ds

    # get rid of the trap number and error code
    addl $0x8, %esp
c01027cc:	83 c4 08             	add    $0x8,%esp
    iret
c01027cf:	cf                   	iret   

c01027d0 <vector0>:
# handler
.text
.globl __alltraps
.globl vector0
vector0:
  pushl $0
c01027d0:	6a 00                	push   $0x0
  pushl $0
c01027d2:	6a 00                	push   $0x0
  jmp __alltraps
c01027d4:	e9 d5 ff ff ff       	jmp    c01027ae <__alltraps>

c01027d9 <vector1>:
.globl vector1
vector1:
  pushl $0
c01027d9:	6a 00                	push   $0x0
  pushl $1
c01027db:	6a 01                	push   $0x1
  jmp __alltraps
c01027dd:	e9 cc ff ff ff       	jmp    c01027ae <__alltraps>

c01027e2 <vector2>:
.globl vector2
vector2:
  pushl $0
c01027e2:	6a 00                	push   $0x0
  pushl $2
c01027e4:	6a 02                	push   $0x2
  jmp __alltraps
c01027e6:	e9 c3 ff ff ff       	jmp    c01027ae <__alltraps>

c01027eb <vector3>:
.globl vector3
vector3:
  pushl $0
c01027eb:	6a 00                	push   $0x0
  pushl $3
c01027ed:	6a 03                	push   $0x3
  jmp __alltraps
c01027ef:	e9 ba ff ff ff       	jmp    c01027ae <__alltraps>

c01027f4 <vector4>:
.globl vector4
vector4:
  pushl $0
c01027f4:	6a 00                	push   $0x0
  pushl $4
c01027f6:	6a 04                	push   $0x4
  jmp __alltraps
c01027f8:	e9 b1 ff ff ff       	jmp    c01027ae <__alltraps>

c01027fd <vector5>:
.globl vector5
vector5:
  pushl $0
c01027fd:	6a 00                	push   $0x0
  pushl $5
c01027ff:	6a 05                	push   $0x5
  jmp __alltraps
c0102801:	e9 a8 ff ff ff       	jmp    c01027ae <__alltraps>

c0102806 <vector6>:
.globl vector6
vector6:
  pushl $0
c0102806:	6a 00                	push   $0x0
  pushl $6
c0102808:	6a 06                	push   $0x6
  jmp __alltraps
c010280a:	e9 9f ff ff ff       	jmp    c01027ae <__alltraps>

c010280f <vector7>:
.globl vector7
vector7:
  pushl $0
c010280f:	6a 00                	push   $0x0
  pushl $7
c0102811:	6a 07                	push   $0x7
  jmp __alltraps
c0102813:	e9 96 ff ff ff       	jmp    c01027ae <__alltraps>

c0102818 <vector8>:
.globl vector8
vector8:
  pushl $8
c0102818:	6a 08                	push   $0x8
  jmp __alltraps
c010281a:	e9 8f ff ff ff       	jmp    c01027ae <__alltraps>

c010281f <vector9>:
.globl vector9
vector9:
  pushl $9
c010281f:	6a 09                	push   $0x9
  jmp __alltraps
c0102821:	e9 88 ff ff ff       	jmp    c01027ae <__alltraps>

c0102826 <vector10>:
.globl vector10
vector10:
  pushl $10
c0102826:	6a 0a                	push   $0xa
  jmp __alltraps
c0102828:	e9 81 ff ff ff       	jmp    c01027ae <__alltraps>

c010282d <vector11>:
.globl vector11
vector11:
  pushl $11
c010282d:	6a 0b                	push   $0xb
  jmp __alltraps
c010282f:	e9 7a ff ff ff       	jmp    c01027ae <__alltraps>

c0102834 <vector12>:
.globl vector12
vector12:
  pushl $12
c0102834:	6a 0c                	push   $0xc
  jmp __alltraps
c0102836:	e9 73 ff ff ff       	jmp    c01027ae <__alltraps>

c010283b <vector13>:
.globl vector13
vector13:
  pushl $13
c010283b:	6a 0d                	push   $0xd
  jmp __alltraps
c010283d:	e9 6c ff ff ff       	jmp    c01027ae <__alltraps>

c0102842 <vector14>:
.globl vector14
vector14:
  pushl $14
c0102842:	6a 0e                	push   $0xe
  jmp __alltraps
c0102844:	e9 65 ff ff ff       	jmp    c01027ae <__alltraps>

c0102849 <vector15>:
.globl vector15
vector15:
  pushl $0
c0102849:	6a 00                	push   $0x0
  pushl $15
c010284b:	6a 0f                	push   $0xf
  jmp __alltraps
c010284d:	e9 5c ff ff ff       	jmp    c01027ae <__alltraps>

c0102852 <vector16>:
.globl vector16
vector16:
  pushl $0
c0102852:	6a 00                	push   $0x0
  pushl $16
c0102854:	6a 10                	push   $0x10
  jmp __alltraps
c0102856:	e9 53 ff ff ff       	jmp    c01027ae <__alltraps>

c010285b <vector17>:
.globl vector17
vector17:
  pushl $17
c010285b:	6a 11                	push   $0x11
  jmp __alltraps
c010285d:	e9 4c ff ff ff       	jmp    c01027ae <__alltraps>

c0102862 <vector18>:
.globl vector18
vector18:
  pushl $0
c0102862:	6a 00                	push   $0x0
  pushl $18
c0102864:	6a 12                	push   $0x12
  jmp __alltraps
c0102866:	e9 43 ff ff ff       	jmp    c01027ae <__alltraps>

c010286b <vector19>:
.globl vector19
vector19:
  pushl $0
c010286b:	6a 00                	push   $0x0
  pushl $19
c010286d:	6a 13                	push   $0x13
  jmp __alltraps
c010286f:	e9 3a ff ff ff       	jmp    c01027ae <__alltraps>

c0102874 <vector20>:
.globl vector20
vector20:
  pushl $0
c0102874:	6a 00                	push   $0x0
  pushl $20
c0102876:	6a 14                	push   $0x14
  jmp __alltraps
c0102878:	e9 31 ff ff ff       	jmp    c01027ae <__alltraps>

c010287d <vector21>:
.globl vector21
vector21:
  pushl $0
c010287d:	6a 00                	push   $0x0
  pushl $21
c010287f:	6a 15                	push   $0x15
  jmp __alltraps
c0102881:	e9 28 ff ff ff       	jmp    c01027ae <__alltraps>

c0102886 <vector22>:
.globl vector22
vector22:
  pushl $0
c0102886:	6a 00                	push   $0x0
  pushl $22
c0102888:	6a 16                	push   $0x16
  jmp __alltraps
c010288a:	e9 1f ff ff ff       	jmp    c01027ae <__alltraps>

c010288f <vector23>:
.globl vector23
vector23:
  pushl $0
c010288f:	6a 00                	push   $0x0
  pushl $23
c0102891:	6a 17                	push   $0x17
  jmp __alltraps
c0102893:	e9 16 ff ff ff       	jmp    c01027ae <__alltraps>

c0102898 <vector24>:
.globl vector24
vector24:
  pushl $0
c0102898:	6a 00                	push   $0x0
  pushl $24
c010289a:	6a 18                	push   $0x18
  jmp __alltraps
c010289c:	e9 0d ff ff ff       	jmp    c01027ae <__alltraps>

c01028a1 <vector25>:
.globl vector25
vector25:
  pushl $0
c01028a1:	6a 00                	push   $0x0
  pushl $25
c01028a3:	6a 19                	push   $0x19
  jmp __alltraps
c01028a5:	e9 04 ff ff ff       	jmp    c01027ae <__alltraps>

c01028aa <vector26>:
.globl vector26
vector26:
  pushl $0
c01028aa:	6a 00                	push   $0x0
  pushl $26
c01028ac:	6a 1a                	push   $0x1a
  jmp __alltraps
c01028ae:	e9 fb fe ff ff       	jmp    c01027ae <__alltraps>

c01028b3 <vector27>:
.globl vector27
vector27:
  pushl $0
c01028b3:	6a 00                	push   $0x0
  pushl $27
c01028b5:	6a 1b                	push   $0x1b
  jmp __alltraps
c01028b7:	e9 f2 fe ff ff       	jmp    c01027ae <__alltraps>

c01028bc <vector28>:
.globl vector28
vector28:
  pushl $0
c01028bc:	6a 00                	push   $0x0
  pushl $28
c01028be:	6a 1c                	push   $0x1c
  jmp __alltraps
c01028c0:	e9 e9 fe ff ff       	jmp    c01027ae <__alltraps>

c01028c5 <vector29>:
.globl vector29
vector29:
  pushl $0
c01028c5:	6a 00                	push   $0x0
  pushl $29
c01028c7:	6a 1d                	push   $0x1d
  jmp __alltraps
c01028c9:	e9 e0 fe ff ff       	jmp    c01027ae <__alltraps>

c01028ce <vector30>:
.globl vector30
vector30:
  pushl $0
c01028ce:	6a 00                	push   $0x0
  pushl $30
c01028d0:	6a 1e                	push   $0x1e
  jmp __alltraps
c01028d2:	e9 d7 fe ff ff       	jmp    c01027ae <__alltraps>

c01028d7 <vector31>:
.globl vector31
vector31:
  pushl $0
c01028d7:	6a 00                	push   $0x0
  pushl $31
c01028d9:	6a 1f                	push   $0x1f
  jmp __alltraps
c01028db:	e9 ce fe ff ff       	jmp    c01027ae <__alltraps>

c01028e0 <vector32>:
.globl vector32
vector32:
  pushl $0
c01028e0:	6a 00                	push   $0x0
  pushl $32
c01028e2:	6a 20                	push   $0x20
  jmp __alltraps
c01028e4:	e9 c5 fe ff ff       	jmp    c01027ae <__alltraps>

c01028e9 <vector33>:
.globl vector33
vector33:
  pushl $0
c01028e9:	6a 00                	push   $0x0
  pushl $33
c01028eb:	6a 21                	push   $0x21
  jmp __alltraps
c01028ed:	e9 bc fe ff ff       	jmp    c01027ae <__alltraps>

c01028f2 <vector34>:
.globl vector34
vector34:
  pushl $0
c01028f2:	6a 00                	push   $0x0
  pushl $34
c01028f4:	6a 22                	push   $0x22
  jmp __alltraps
c01028f6:	e9 b3 fe ff ff       	jmp    c01027ae <__alltraps>

c01028fb <vector35>:
.globl vector35
vector35:
  pushl $0
c01028fb:	6a 00                	push   $0x0
  pushl $35
c01028fd:	6a 23                	push   $0x23
  jmp __alltraps
c01028ff:	e9 aa fe ff ff       	jmp    c01027ae <__alltraps>

c0102904 <vector36>:
.globl vector36
vector36:
  pushl $0
c0102904:	6a 00                	push   $0x0
  pushl $36
c0102906:	6a 24                	push   $0x24
  jmp __alltraps
c0102908:	e9 a1 fe ff ff       	jmp    c01027ae <__alltraps>

c010290d <vector37>:
.globl vector37
vector37:
  pushl $0
c010290d:	6a 00                	push   $0x0
  pushl $37
c010290f:	6a 25                	push   $0x25
  jmp __alltraps
c0102911:	e9 98 fe ff ff       	jmp    c01027ae <__alltraps>

c0102916 <vector38>:
.globl vector38
vector38:
  pushl $0
c0102916:	6a 00                	push   $0x0
  pushl $38
c0102918:	6a 26                	push   $0x26
  jmp __alltraps
c010291a:	e9 8f fe ff ff       	jmp    c01027ae <__alltraps>

c010291f <vector39>:
.globl vector39
vector39:
  pushl $0
c010291f:	6a 00                	push   $0x0
  pushl $39
c0102921:	6a 27                	push   $0x27
  jmp __alltraps
c0102923:	e9 86 fe ff ff       	jmp    c01027ae <__alltraps>

c0102928 <vector40>:
.globl vector40
vector40:
  pushl $0
c0102928:	6a 00                	push   $0x0
  pushl $40
c010292a:	6a 28                	push   $0x28
  jmp __alltraps
c010292c:	e9 7d fe ff ff       	jmp    c01027ae <__alltraps>

c0102931 <vector41>:
.globl vector41
vector41:
  pushl $0
c0102931:	6a 00                	push   $0x0
  pushl $41
c0102933:	6a 29                	push   $0x29
  jmp __alltraps
c0102935:	e9 74 fe ff ff       	jmp    c01027ae <__alltraps>

c010293a <vector42>:
.globl vector42
vector42:
  pushl $0
c010293a:	6a 00                	push   $0x0
  pushl $42
c010293c:	6a 2a                	push   $0x2a
  jmp __alltraps
c010293e:	e9 6b fe ff ff       	jmp    c01027ae <__alltraps>

c0102943 <vector43>:
.globl vector43
vector43:
  pushl $0
c0102943:	6a 00                	push   $0x0
  pushl $43
c0102945:	6a 2b                	push   $0x2b
  jmp __alltraps
c0102947:	e9 62 fe ff ff       	jmp    c01027ae <__alltraps>

c010294c <vector44>:
.globl vector44
vector44:
  pushl $0
c010294c:	6a 00                	push   $0x0
  pushl $44
c010294e:	6a 2c                	push   $0x2c
  jmp __alltraps
c0102950:	e9 59 fe ff ff       	jmp    c01027ae <__alltraps>

c0102955 <vector45>:
.globl vector45
vector45:
  pushl $0
c0102955:	6a 00                	push   $0x0
  pushl $45
c0102957:	6a 2d                	push   $0x2d
  jmp __alltraps
c0102959:	e9 50 fe ff ff       	jmp    c01027ae <__alltraps>

c010295e <vector46>:
.globl vector46
vector46:
  pushl $0
c010295e:	6a 00                	push   $0x0
  pushl $46
c0102960:	6a 2e                	push   $0x2e
  jmp __alltraps
c0102962:	e9 47 fe ff ff       	jmp    c01027ae <__alltraps>

c0102967 <vector47>:
.globl vector47
vector47:
  pushl $0
c0102967:	6a 00                	push   $0x0
  pushl $47
c0102969:	6a 2f                	push   $0x2f
  jmp __alltraps
c010296b:	e9 3e fe ff ff       	jmp    c01027ae <__alltraps>

c0102970 <vector48>:
.globl vector48
vector48:
  pushl $0
c0102970:	6a 00                	push   $0x0
  pushl $48
c0102972:	6a 30                	push   $0x30
  jmp __alltraps
c0102974:	e9 35 fe ff ff       	jmp    c01027ae <__alltraps>

c0102979 <vector49>:
.globl vector49
vector49:
  pushl $0
c0102979:	6a 00                	push   $0x0
  pushl $49
c010297b:	6a 31                	push   $0x31
  jmp __alltraps
c010297d:	e9 2c fe ff ff       	jmp    c01027ae <__alltraps>

c0102982 <vector50>:
.globl vector50
vector50:
  pushl $0
c0102982:	6a 00                	push   $0x0
  pushl $50
c0102984:	6a 32                	push   $0x32
  jmp __alltraps
c0102986:	e9 23 fe ff ff       	jmp    c01027ae <__alltraps>

c010298b <vector51>:
.globl vector51
vector51:
  pushl $0
c010298b:	6a 00                	push   $0x0
  pushl $51
c010298d:	6a 33                	push   $0x33
  jmp __alltraps
c010298f:	e9 1a fe ff ff       	jmp    c01027ae <__alltraps>

c0102994 <vector52>:
.globl vector52
vector52:
  pushl $0
c0102994:	6a 00                	push   $0x0
  pushl $52
c0102996:	6a 34                	push   $0x34
  jmp __alltraps
c0102998:	e9 11 fe ff ff       	jmp    c01027ae <__alltraps>

c010299d <vector53>:
.globl vector53
vector53:
  pushl $0
c010299d:	6a 00                	push   $0x0
  pushl $53
c010299f:	6a 35                	push   $0x35
  jmp __alltraps
c01029a1:	e9 08 fe ff ff       	jmp    c01027ae <__alltraps>

c01029a6 <vector54>:
.globl vector54
vector54:
  pushl $0
c01029a6:	6a 00                	push   $0x0
  pushl $54
c01029a8:	6a 36                	push   $0x36
  jmp __alltraps
c01029aa:	e9 ff fd ff ff       	jmp    c01027ae <__alltraps>

c01029af <vector55>:
.globl vector55
vector55:
  pushl $0
c01029af:	6a 00                	push   $0x0
  pushl $55
c01029b1:	6a 37                	push   $0x37
  jmp __alltraps
c01029b3:	e9 f6 fd ff ff       	jmp    c01027ae <__alltraps>

c01029b8 <vector56>:
.globl vector56
vector56:
  pushl $0
c01029b8:	6a 00                	push   $0x0
  pushl $56
c01029ba:	6a 38                	push   $0x38
  jmp __alltraps
c01029bc:	e9 ed fd ff ff       	jmp    c01027ae <__alltraps>

c01029c1 <vector57>:
.globl vector57
vector57:
  pushl $0
c01029c1:	6a 00                	push   $0x0
  pushl $57
c01029c3:	6a 39                	push   $0x39
  jmp __alltraps
c01029c5:	e9 e4 fd ff ff       	jmp    c01027ae <__alltraps>

c01029ca <vector58>:
.globl vector58
vector58:
  pushl $0
c01029ca:	6a 00                	push   $0x0
  pushl $58
c01029cc:	6a 3a                	push   $0x3a
  jmp __alltraps
c01029ce:	e9 db fd ff ff       	jmp    c01027ae <__alltraps>

c01029d3 <vector59>:
.globl vector59
vector59:
  pushl $0
c01029d3:	6a 00                	push   $0x0
  pushl $59
c01029d5:	6a 3b                	push   $0x3b
  jmp __alltraps
c01029d7:	e9 d2 fd ff ff       	jmp    c01027ae <__alltraps>

c01029dc <vector60>:
.globl vector60
vector60:
  pushl $0
c01029dc:	6a 00                	push   $0x0
  pushl $60
c01029de:	6a 3c                	push   $0x3c
  jmp __alltraps
c01029e0:	e9 c9 fd ff ff       	jmp    c01027ae <__alltraps>

c01029e5 <vector61>:
.globl vector61
vector61:
  pushl $0
c01029e5:	6a 00                	push   $0x0
  pushl $61
c01029e7:	6a 3d                	push   $0x3d
  jmp __alltraps
c01029e9:	e9 c0 fd ff ff       	jmp    c01027ae <__alltraps>

c01029ee <vector62>:
.globl vector62
vector62:
  pushl $0
c01029ee:	6a 00                	push   $0x0
  pushl $62
c01029f0:	6a 3e                	push   $0x3e
  jmp __alltraps
c01029f2:	e9 b7 fd ff ff       	jmp    c01027ae <__alltraps>

c01029f7 <vector63>:
.globl vector63
vector63:
  pushl $0
c01029f7:	6a 00                	push   $0x0
  pushl $63
c01029f9:	6a 3f                	push   $0x3f
  jmp __alltraps
c01029fb:	e9 ae fd ff ff       	jmp    c01027ae <__alltraps>

c0102a00 <vector64>:
.globl vector64
vector64:
  pushl $0
c0102a00:	6a 00                	push   $0x0
  pushl $64
c0102a02:	6a 40                	push   $0x40
  jmp __alltraps
c0102a04:	e9 a5 fd ff ff       	jmp    c01027ae <__alltraps>

c0102a09 <vector65>:
.globl vector65
vector65:
  pushl $0
c0102a09:	6a 00                	push   $0x0
  pushl $65
c0102a0b:	6a 41                	push   $0x41
  jmp __alltraps
c0102a0d:	e9 9c fd ff ff       	jmp    c01027ae <__alltraps>

c0102a12 <vector66>:
.globl vector66
vector66:
  pushl $0
c0102a12:	6a 00                	push   $0x0
  pushl $66
c0102a14:	6a 42                	push   $0x42
  jmp __alltraps
c0102a16:	e9 93 fd ff ff       	jmp    c01027ae <__alltraps>

c0102a1b <vector67>:
.globl vector67
vector67:
  pushl $0
c0102a1b:	6a 00                	push   $0x0
  pushl $67
c0102a1d:	6a 43                	push   $0x43
  jmp __alltraps
c0102a1f:	e9 8a fd ff ff       	jmp    c01027ae <__alltraps>

c0102a24 <vector68>:
.globl vector68
vector68:
  pushl $0
c0102a24:	6a 00                	push   $0x0
  pushl $68
c0102a26:	6a 44                	push   $0x44
  jmp __alltraps
c0102a28:	e9 81 fd ff ff       	jmp    c01027ae <__alltraps>

c0102a2d <vector69>:
.globl vector69
vector69:
  pushl $0
c0102a2d:	6a 00                	push   $0x0
  pushl $69
c0102a2f:	6a 45                	push   $0x45
  jmp __alltraps
c0102a31:	e9 78 fd ff ff       	jmp    c01027ae <__alltraps>

c0102a36 <vector70>:
.globl vector70
vector70:
  pushl $0
c0102a36:	6a 00                	push   $0x0
  pushl $70
c0102a38:	6a 46                	push   $0x46
  jmp __alltraps
c0102a3a:	e9 6f fd ff ff       	jmp    c01027ae <__alltraps>

c0102a3f <vector71>:
.globl vector71
vector71:
  pushl $0
c0102a3f:	6a 00                	push   $0x0
  pushl $71
c0102a41:	6a 47                	push   $0x47
  jmp __alltraps
c0102a43:	e9 66 fd ff ff       	jmp    c01027ae <__alltraps>

c0102a48 <vector72>:
.globl vector72
vector72:
  pushl $0
c0102a48:	6a 00                	push   $0x0
  pushl $72
c0102a4a:	6a 48                	push   $0x48
  jmp __alltraps
c0102a4c:	e9 5d fd ff ff       	jmp    c01027ae <__alltraps>

c0102a51 <vector73>:
.globl vector73
vector73:
  pushl $0
c0102a51:	6a 00                	push   $0x0
  pushl $73
c0102a53:	6a 49                	push   $0x49
  jmp __alltraps
c0102a55:	e9 54 fd ff ff       	jmp    c01027ae <__alltraps>

c0102a5a <vector74>:
.globl vector74
vector74:
  pushl $0
c0102a5a:	6a 00                	push   $0x0
  pushl $74
c0102a5c:	6a 4a                	push   $0x4a
  jmp __alltraps
c0102a5e:	e9 4b fd ff ff       	jmp    c01027ae <__alltraps>

c0102a63 <vector75>:
.globl vector75
vector75:
  pushl $0
c0102a63:	6a 00                	push   $0x0
  pushl $75
c0102a65:	6a 4b                	push   $0x4b
  jmp __alltraps
c0102a67:	e9 42 fd ff ff       	jmp    c01027ae <__alltraps>

c0102a6c <vector76>:
.globl vector76
vector76:
  pushl $0
c0102a6c:	6a 00                	push   $0x0
  pushl $76
c0102a6e:	6a 4c                	push   $0x4c
  jmp __alltraps
c0102a70:	e9 39 fd ff ff       	jmp    c01027ae <__alltraps>

c0102a75 <vector77>:
.globl vector77
vector77:
  pushl $0
c0102a75:	6a 00                	push   $0x0
  pushl $77
c0102a77:	6a 4d                	push   $0x4d
  jmp __alltraps
c0102a79:	e9 30 fd ff ff       	jmp    c01027ae <__alltraps>

c0102a7e <vector78>:
.globl vector78
vector78:
  pushl $0
c0102a7e:	6a 00                	push   $0x0
  pushl $78
c0102a80:	6a 4e                	push   $0x4e
  jmp __alltraps
c0102a82:	e9 27 fd ff ff       	jmp    c01027ae <__alltraps>

c0102a87 <vector79>:
.globl vector79
vector79:
  pushl $0
c0102a87:	6a 00                	push   $0x0
  pushl $79
c0102a89:	6a 4f                	push   $0x4f
  jmp __alltraps
c0102a8b:	e9 1e fd ff ff       	jmp    c01027ae <__alltraps>

c0102a90 <vector80>:
.globl vector80
vector80:
  pushl $0
c0102a90:	6a 00                	push   $0x0
  pushl $80
c0102a92:	6a 50                	push   $0x50
  jmp __alltraps
c0102a94:	e9 15 fd ff ff       	jmp    c01027ae <__alltraps>

c0102a99 <vector81>:
.globl vector81
vector81:
  pushl $0
c0102a99:	6a 00                	push   $0x0
  pushl $81
c0102a9b:	6a 51                	push   $0x51
  jmp __alltraps
c0102a9d:	e9 0c fd ff ff       	jmp    c01027ae <__alltraps>

c0102aa2 <vector82>:
.globl vector82
vector82:
  pushl $0
c0102aa2:	6a 00                	push   $0x0
  pushl $82
c0102aa4:	6a 52                	push   $0x52
  jmp __alltraps
c0102aa6:	e9 03 fd ff ff       	jmp    c01027ae <__alltraps>

c0102aab <vector83>:
.globl vector83
vector83:
  pushl $0
c0102aab:	6a 00                	push   $0x0
  pushl $83
c0102aad:	6a 53                	push   $0x53
  jmp __alltraps
c0102aaf:	e9 fa fc ff ff       	jmp    c01027ae <__alltraps>

c0102ab4 <vector84>:
.globl vector84
vector84:
  pushl $0
c0102ab4:	6a 00                	push   $0x0
  pushl $84
c0102ab6:	6a 54                	push   $0x54
  jmp __alltraps
c0102ab8:	e9 f1 fc ff ff       	jmp    c01027ae <__alltraps>

c0102abd <vector85>:
.globl vector85
vector85:
  pushl $0
c0102abd:	6a 00                	push   $0x0
  pushl $85
c0102abf:	6a 55                	push   $0x55
  jmp __alltraps
c0102ac1:	e9 e8 fc ff ff       	jmp    c01027ae <__alltraps>

c0102ac6 <vector86>:
.globl vector86
vector86:
  pushl $0
c0102ac6:	6a 00                	push   $0x0
  pushl $86
c0102ac8:	6a 56                	push   $0x56
  jmp __alltraps
c0102aca:	e9 df fc ff ff       	jmp    c01027ae <__alltraps>

c0102acf <vector87>:
.globl vector87
vector87:
  pushl $0
c0102acf:	6a 00                	push   $0x0
  pushl $87
c0102ad1:	6a 57                	push   $0x57
  jmp __alltraps
c0102ad3:	e9 d6 fc ff ff       	jmp    c01027ae <__alltraps>

c0102ad8 <vector88>:
.globl vector88
vector88:
  pushl $0
c0102ad8:	6a 00                	push   $0x0
  pushl $88
c0102ada:	6a 58                	push   $0x58
  jmp __alltraps
c0102adc:	e9 cd fc ff ff       	jmp    c01027ae <__alltraps>

c0102ae1 <vector89>:
.globl vector89
vector89:
  pushl $0
c0102ae1:	6a 00                	push   $0x0
  pushl $89
c0102ae3:	6a 59                	push   $0x59
  jmp __alltraps
c0102ae5:	e9 c4 fc ff ff       	jmp    c01027ae <__alltraps>

c0102aea <vector90>:
.globl vector90
vector90:
  pushl $0
c0102aea:	6a 00                	push   $0x0
  pushl $90
c0102aec:	6a 5a                	push   $0x5a
  jmp __alltraps
c0102aee:	e9 bb fc ff ff       	jmp    c01027ae <__alltraps>

c0102af3 <vector91>:
.globl vector91
vector91:
  pushl $0
c0102af3:	6a 00                	push   $0x0
  pushl $91
c0102af5:	6a 5b                	push   $0x5b
  jmp __alltraps
c0102af7:	e9 b2 fc ff ff       	jmp    c01027ae <__alltraps>

c0102afc <vector92>:
.globl vector92
vector92:
  pushl $0
c0102afc:	6a 00                	push   $0x0
  pushl $92
c0102afe:	6a 5c                	push   $0x5c
  jmp __alltraps
c0102b00:	e9 a9 fc ff ff       	jmp    c01027ae <__alltraps>

c0102b05 <vector93>:
.globl vector93
vector93:
  pushl $0
c0102b05:	6a 00                	push   $0x0
  pushl $93
c0102b07:	6a 5d                	push   $0x5d
  jmp __alltraps
c0102b09:	e9 a0 fc ff ff       	jmp    c01027ae <__alltraps>

c0102b0e <vector94>:
.globl vector94
vector94:
  pushl $0
c0102b0e:	6a 00                	push   $0x0
  pushl $94
c0102b10:	6a 5e                	push   $0x5e
  jmp __alltraps
c0102b12:	e9 97 fc ff ff       	jmp    c01027ae <__alltraps>

c0102b17 <vector95>:
.globl vector95
vector95:
  pushl $0
c0102b17:	6a 00                	push   $0x0
  pushl $95
c0102b19:	6a 5f                	push   $0x5f
  jmp __alltraps
c0102b1b:	e9 8e fc ff ff       	jmp    c01027ae <__alltraps>

c0102b20 <vector96>:
.globl vector96
vector96:
  pushl $0
c0102b20:	6a 00                	push   $0x0
  pushl $96
c0102b22:	6a 60                	push   $0x60
  jmp __alltraps
c0102b24:	e9 85 fc ff ff       	jmp    c01027ae <__alltraps>

c0102b29 <vector97>:
.globl vector97
vector97:
  pushl $0
c0102b29:	6a 00                	push   $0x0
  pushl $97
c0102b2b:	6a 61                	push   $0x61
  jmp __alltraps
c0102b2d:	e9 7c fc ff ff       	jmp    c01027ae <__alltraps>

c0102b32 <vector98>:
.globl vector98
vector98:
  pushl $0
c0102b32:	6a 00                	push   $0x0
  pushl $98
c0102b34:	6a 62                	push   $0x62
  jmp __alltraps
c0102b36:	e9 73 fc ff ff       	jmp    c01027ae <__alltraps>

c0102b3b <vector99>:
.globl vector99
vector99:
  pushl $0
c0102b3b:	6a 00                	push   $0x0
  pushl $99
c0102b3d:	6a 63                	push   $0x63
  jmp __alltraps
c0102b3f:	e9 6a fc ff ff       	jmp    c01027ae <__alltraps>

c0102b44 <vector100>:
.globl vector100
vector100:
  pushl $0
c0102b44:	6a 00                	push   $0x0
  pushl $100
c0102b46:	6a 64                	push   $0x64
  jmp __alltraps
c0102b48:	e9 61 fc ff ff       	jmp    c01027ae <__alltraps>

c0102b4d <vector101>:
.globl vector101
vector101:
  pushl $0
c0102b4d:	6a 00                	push   $0x0
  pushl $101
c0102b4f:	6a 65                	push   $0x65
  jmp __alltraps
c0102b51:	e9 58 fc ff ff       	jmp    c01027ae <__alltraps>

c0102b56 <vector102>:
.globl vector102
vector102:
  pushl $0
c0102b56:	6a 00                	push   $0x0
  pushl $102
c0102b58:	6a 66                	push   $0x66
  jmp __alltraps
c0102b5a:	e9 4f fc ff ff       	jmp    c01027ae <__alltraps>

c0102b5f <vector103>:
.globl vector103
vector103:
  pushl $0
c0102b5f:	6a 00                	push   $0x0
  pushl $103
c0102b61:	6a 67                	push   $0x67
  jmp __alltraps
c0102b63:	e9 46 fc ff ff       	jmp    c01027ae <__alltraps>

c0102b68 <vector104>:
.globl vector104
vector104:
  pushl $0
c0102b68:	6a 00                	push   $0x0
  pushl $104
c0102b6a:	6a 68                	push   $0x68
  jmp __alltraps
c0102b6c:	e9 3d fc ff ff       	jmp    c01027ae <__alltraps>

c0102b71 <vector105>:
.globl vector105
vector105:
  pushl $0
c0102b71:	6a 00                	push   $0x0
  pushl $105
c0102b73:	6a 69                	push   $0x69
  jmp __alltraps
c0102b75:	e9 34 fc ff ff       	jmp    c01027ae <__alltraps>

c0102b7a <vector106>:
.globl vector106
vector106:
  pushl $0
c0102b7a:	6a 00                	push   $0x0
  pushl $106
c0102b7c:	6a 6a                	push   $0x6a
  jmp __alltraps
c0102b7e:	e9 2b fc ff ff       	jmp    c01027ae <__alltraps>

c0102b83 <vector107>:
.globl vector107
vector107:
  pushl $0
c0102b83:	6a 00                	push   $0x0
  pushl $107
c0102b85:	6a 6b                	push   $0x6b
  jmp __alltraps
c0102b87:	e9 22 fc ff ff       	jmp    c01027ae <__alltraps>

c0102b8c <vector108>:
.globl vector108
vector108:
  pushl $0
c0102b8c:	6a 00                	push   $0x0
  pushl $108
c0102b8e:	6a 6c                	push   $0x6c
  jmp __alltraps
c0102b90:	e9 19 fc ff ff       	jmp    c01027ae <__alltraps>

c0102b95 <vector109>:
.globl vector109
vector109:
  pushl $0
c0102b95:	6a 00                	push   $0x0
  pushl $109
c0102b97:	6a 6d                	push   $0x6d
  jmp __alltraps
c0102b99:	e9 10 fc ff ff       	jmp    c01027ae <__alltraps>

c0102b9e <vector110>:
.globl vector110
vector110:
  pushl $0
c0102b9e:	6a 00                	push   $0x0
  pushl $110
c0102ba0:	6a 6e                	push   $0x6e
  jmp __alltraps
c0102ba2:	e9 07 fc ff ff       	jmp    c01027ae <__alltraps>

c0102ba7 <vector111>:
.globl vector111
vector111:
  pushl $0
c0102ba7:	6a 00                	push   $0x0
  pushl $111
c0102ba9:	6a 6f                	push   $0x6f
  jmp __alltraps
c0102bab:	e9 fe fb ff ff       	jmp    c01027ae <__alltraps>

c0102bb0 <vector112>:
.globl vector112
vector112:
  pushl $0
c0102bb0:	6a 00                	push   $0x0
  pushl $112
c0102bb2:	6a 70                	push   $0x70
  jmp __alltraps
c0102bb4:	e9 f5 fb ff ff       	jmp    c01027ae <__alltraps>

c0102bb9 <vector113>:
.globl vector113
vector113:
  pushl $0
c0102bb9:	6a 00                	push   $0x0
  pushl $113
c0102bbb:	6a 71                	push   $0x71
  jmp __alltraps
c0102bbd:	e9 ec fb ff ff       	jmp    c01027ae <__alltraps>

c0102bc2 <vector114>:
.globl vector114
vector114:
  pushl $0
c0102bc2:	6a 00                	push   $0x0
  pushl $114
c0102bc4:	6a 72                	push   $0x72
  jmp __alltraps
c0102bc6:	e9 e3 fb ff ff       	jmp    c01027ae <__alltraps>

c0102bcb <vector115>:
.globl vector115
vector115:
  pushl $0
c0102bcb:	6a 00                	push   $0x0
  pushl $115
c0102bcd:	6a 73                	push   $0x73
  jmp __alltraps
c0102bcf:	e9 da fb ff ff       	jmp    c01027ae <__alltraps>

c0102bd4 <vector116>:
.globl vector116
vector116:
  pushl $0
c0102bd4:	6a 00                	push   $0x0
  pushl $116
c0102bd6:	6a 74                	push   $0x74
  jmp __alltraps
c0102bd8:	e9 d1 fb ff ff       	jmp    c01027ae <__alltraps>

c0102bdd <vector117>:
.globl vector117
vector117:
  pushl $0
c0102bdd:	6a 00                	push   $0x0
  pushl $117
c0102bdf:	6a 75                	push   $0x75
  jmp __alltraps
c0102be1:	e9 c8 fb ff ff       	jmp    c01027ae <__alltraps>

c0102be6 <vector118>:
.globl vector118
vector118:
  pushl $0
c0102be6:	6a 00                	push   $0x0
  pushl $118
c0102be8:	6a 76                	push   $0x76
  jmp __alltraps
c0102bea:	e9 bf fb ff ff       	jmp    c01027ae <__alltraps>

c0102bef <vector119>:
.globl vector119
vector119:
  pushl $0
c0102bef:	6a 00                	push   $0x0
  pushl $119
c0102bf1:	6a 77                	push   $0x77
  jmp __alltraps
c0102bf3:	e9 b6 fb ff ff       	jmp    c01027ae <__alltraps>

c0102bf8 <vector120>:
.globl vector120
vector120:
  pushl $0
c0102bf8:	6a 00                	push   $0x0
  pushl $120
c0102bfa:	6a 78                	push   $0x78
  jmp __alltraps
c0102bfc:	e9 ad fb ff ff       	jmp    c01027ae <__alltraps>

c0102c01 <vector121>:
.globl vector121
vector121:
  pushl $0
c0102c01:	6a 00                	push   $0x0
  pushl $121
c0102c03:	6a 79                	push   $0x79
  jmp __alltraps
c0102c05:	e9 a4 fb ff ff       	jmp    c01027ae <__alltraps>

c0102c0a <vector122>:
.globl vector122
vector122:
  pushl $0
c0102c0a:	6a 00                	push   $0x0
  pushl $122
c0102c0c:	6a 7a                	push   $0x7a
  jmp __alltraps
c0102c0e:	e9 9b fb ff ff       	jmp    c01027ae <__alltraps>

c0102c13 <vector123>:
.globl vector123
vector123:
  pushl $0
c0102c13:	6a 00                	push   $0x0
  pushl $123
c0102c15:	6a 7b                	push   $0x7b
  jmp __alltraps
c0102c17:	e9 92 fb ff ff       	jmp    c01027ae <__alltraps>

c0102c1c <vector124>:
.globl vector124
vector124:
  pushl $0
c0102c1c:	6a 00                	push   $0x0
  pushl $124
c0102c1e:	6a 7c                	push   $0x7c
  jmp __alltraps
c0102c20:	e9 89 fb ff ff       	jmp    c01027ae <__alltraps>

c0102c25 <vector125>:
.globl vector125
vector125:
  pushl $0
c0102c25:	6a 00                	push   $0x0
  pushl $125
c0102c27:	6a 7d                	push   $0x7d
  jmp __alltraps
c0102c29:	e9 80 fb ff ff       	jmp    c01027ae <__alltraps>

c0102c2e <vector126>:
.globl vector126
vector126:
  pushl $0
c0102c2e:	6a 00                	push   $0x0
  pushl $126
c0102c30:	6a 7e                	push   $0x7e
  jmp __alltraps
c0102c32:	e9 77 fb ff ff       	jmp    c01027ae <__alltraps>

c0102c37 <vector127>:
.globl vector127
vector127:
  pushl $0
c0102c37:	6a 00                	push   $0x0
  pushl $127
c0102c39:	6a 7f                	push   $0x7f
  jmp __alltraps
c0102c3b:	e9 6e fb ff ff       	jmp    c01027ae <__alltraps>

c0102c40 <vector128>:
.globl vector128
vector128:
  pushl $0
c0102c40:	6a 00                	push   $0x0
  pushl $128
c0102c42:	68 80 00 00 00       	push   $0x80
  jmp __alltraps
c0102c47:	e9 62 fb ff ff       	jmp    c01027ae <__alltraps>

c0102c4c <vector129>:
.globl vector129
vector129:
  pushl $0
c0102c4c:	6a 00                	push   $0x0
  pushl $129
c0102c4e:	68 81 00 00 00       	push   $0x81
  jmp __alltraps
c0102c53:	e9 56 fb ff ff       	jmp    c01027ae <__alltraps>

c0102c58 <vector130>:
.globl vector130
vector130:
  pushl $0
c0102c58:	6a 00                	push   $0x0
  pushl $130
c0102c5a:	68 82 00 00 00       	push   $0x82
  jmp __alltraps
c0102c5f:	e9 4a fb ff ff       	jmp    c01027ae <__alltraps>

c0102c64 <vector131>:
.globl vector131
vector131:
  pushl $0
c0102c64:	6a 00                	push   $0x0
  pushl $131
c0102c66:	68 83 00 00 00       	push   $0x83
  jmp __alltraps
c0102c6b:	e9 3e fb ff ff       	jmp    c01027ae <__alltraps>

c0102c70 <vector132>:
.globl vector132
vector132:
  pushl $0
c0102c70:	6a 00                	push   $0x0
  pushl $132
c0102c72:	68 84 00 00 00       	push   $0x84
  jmp __alltraps
c0102c77:	e9 32 fb ff ff       	jmp    c01027ae <__alltraps>

c0102c7c <vector133>:
.globl vector133
vector133:
  pushl $0
c0102c7c:	6a 00                	push   $0x0
  pushl $133
c0102c7e:	68 85 00 00 00       	push   $0x85
  jmp __alltraps
c0102c83:	e9 26 fb ff ff       	jmp    c01027ae <__alltraps>

c0102c88 <vector134>:
.globl vector134
vector134:
  pushl $0
c0102c88:	6a 00                	push   $0x0
  pushl $134
c0102c8a:	68 86 00 00 00       	push   $0x86
  jmp __alltraps
c0102c8f:	e9 1a fb ff ff       	jmp    c01027ae <__alltraps>

c0102c94 <vector135>:
.globl vector135
vector135:
  pushl $0
c0102c94:	6a 00                	push   $0x0
  pushl $135
c0102c96:	68 87 00 00 00       	push   $0x87
  jmp __alltraps
c0102c9b:	e9 0e fb ff ff       	jmp    c01027ae <__alltraps>

c0102ca0 <vector136>:
.globl vector136
vector136:
  pushl $0
c0102ca0:	6a 00                	push   $0x0
  pushl $136
c0102ca2:	68 88 00 00 00       	push   $0x88
  jmp __alltraps
c0102ca7:	e9 02 fb ff ff       	jmp    c01027ae <__alltraps>

c0102cac <vector137>:
.globl vector137
vector137:
  pushl $0
c0102cac:	6a 00                	push   $0x0
  pushl $137
c0102cae:	68 89 00 00 00       	push   $0x89
  jmp __alltraps
c0102cb3:	e9 f6 fa ff ff       	jmp    c01027ae <__alltraps>

c0102cb8 <vector138>:
.globl vector138
vector138:
  pushl $0
c0102cb8:	6a 00                	push   $0x0
  pushl $138
c0102cba:	68 8a 00 00 00       	push   $0x8a
  jmp __alltraps
c0102cbf:	e9 ea fa ff ff       	jmp    c01027ae <__alltraps>

c0102cc4 <vector139>:
.globl vector139
vector139:
  pushl $0
c0102cc4:	6a 00                	push   $0x0
  pushl $139
c0102cc6:	68 8b 00 00 00       	push   $0x8b
  jmp __alltraps
c0102ccb:	e9 de fa ff ff       	jmp    c01027ae <__alltraps>

c0102cd0 <vector140>:
.globl vector140
vector140:
  pushl $0
c0102cd0:	6a 00                	push   $0x0
  pushl $140
c0102cd2:	68 8c 00 00 00       	push   $0x8c
  jmp __alltraps
c0102cd7:	e9 d2 fa ff ff       	jmp    c01027ae <__alltraps>

c0102cdc <vector141>:
.globl vector141
vector141:
  pushl $0
c0102cdc:	6a 00                	push   $0x0
  pushl $141
c0102cde:	68 8d 00 00 00       	push   $0x8d
  jmp __alltraps
c0102ce3:	e9 c6 fa ff ff       	jmp    c01027ae <__alltraps>

c0102ce8 <vector142>:
.globl vector142
vector142:
  pushl $0
c0102ce8:	6a 00                	push   $0x0
  pushl $142
c0102cea:	68 8e 00 00 00       	push   $0x8e
  jmp __alltraps
c0102cef:	e9 ba fa ff ff       	jmp    c01027ae <__alltraps>

c0102cf4 <vector143>:
.globl vector143
vector143:
  pushl $0
c0102cf4:	6a 00                	push   $0x0
  pushl $143
c0102cf6:	68 8f 00 00 00       	push   $0x8f
  jmp __alltraps
c0102cfb:	e9 ae fa ff ff       	jmp    c01027ae <__alltraps>

c0102d00 <vector144>:
.globl vector144
vector144:
  pushl $0
c0102d00:	6a 00                	push   $0x0
  pushl $144
c0102d02:	68 90 00 00 00       	push   $0x90
  jmp __alltraps
c0102d07:	e9 a2 fa ff ff       	jmp    c01027ae <__alltraps>

c0102d0c <vector145>:
.globl vector145
vector145:
  pushl $0
c0102d0c:	6a 00                	push   $0x0
  pushl $145
c0102d0e:	68 91 00 00 00       	push   $0x91
  jmp __alltraps
c0102d13:	e9 96 fa ff ff       	jmp    c01027ae <__alltraps>

c0102d18 <vector146>:
.globl vector146
vector146:
  pushl $0
c0102d18:	6a 00                	push   $0x0
  pushl $146
c0102d1a:	68 92 00 00 00       	push   $0x92
  jmp __alltraps
c0102d1f:	e9 8a fa ff ff       	jmp    c01027ae <__alltraps>

c0102d24 <vector147>:
.globl vector147
vector147:
  pushl $0
c0102d24:	6a 00                	push   $0x0
  pushl $147
c0102d26:	68 93 00 00 00       	push   $0x93
  jmp __alltraps
c0102d2b:	e9 7e fa ff ff       	jmp    c01027ae <__alltraps>

c0102d30 <vector148>:
.globl vector148
vector148:
  pushl $0
c0102d30:	6a 00                	push   $0x0
  pushl $148
c0102d32:	68 94 00 00 00       	push   $0x94
  jmp __alltraps
c0102d37:	e9 72 fa ff ff       	jmp    c01027ae <__alltraps>

c0102d3c <vector149>:
.globl vector149
vector149:
  pushl $0
c0102d3c:	6a 00                	push   $0x0
  pushl $149
c0102d3e:	68 95 00 00 00       	push   $0x95
  jmp __alltraps
c0102d43:	e9 66 fa ff ff       	jmp    c01027ae <__alltraps>

c0102d48 <vector150>:
.globl vector150
vector150:
  pushl $0
c0102d48:	6a 00                	push   $0x0
  pushl $150
c0102d4a:	68 96 00 00 00       	push   $0x96
  jmp __alltraps
c0102d4f:	e9 5a fa ff ff       	jmp    c01027ae <__alltraps>

c0102d54 <vector151>:
.globl vector151
vector151:
  pushl $0
c0102d54:	6a 00                	push   $0x0
  pushl $151
c0102d56:	68 97 00 00 00       	push   $0x97
  jmp __alltraps
c0102d5b:	e9 4e fa ff ff       	jmp    c01027ae <__alltraps>

c0102d60 <vector152>:
.globl vector152
vector152:
  pushl $0
c0102d60:	6a 00                	push   $0x0
  pushl $152
c0102d62:	68 98 00 00 00       	push   $0x98
  jmp __alltraps
c0102d67:	e9 42 fa ff ff       	jmp    c01027ae <__alltraps>

c0102d6c <vector153>:
.globl vector153
vector153:
  pushl $0
c0102d6c:	6a 00                	push   $0x0
  pushl $153
c0102d6e:	68 99 00 00 00       	push   $0x99
  jmp __alltraps
c0102d73:	e9 36 fa ff ff       	jmp    c01027ae <__alltraps>

c0102d78 <vector154>:
.globl vector154
vector154:
  pushl $0
c0102d78:	6a 00                	push   $0x0
  pushl $154
c0102d7a:	68 9a 00 00 00       	push   $0x9a
  jmp __alltraps
c0102d7f:	e9 2a fa ff ff       	jmp    c01027ae <__alltraps>

c0102d84 <vector155>:
.globl vector155
vector155:
  pushl $0
c0102d84:	6a 00                	push   $0x0
  pushl $155
c0102d86:	68 9b 00 00 00       	push   $0x9b
  jmp __alltraps
c0102d8b:	e9 1e fa ff ff       	jmp    c01027ae <__alltraps>

c0102d90 <vector156>:
.globl vector156
vector156:
  pushl $0
c0102d90:	6a 00                	push   $0x0
  pushl $156
c0102d92:	68 9c 00 00 00       	push   $0x9c
  jmp __alltraps
c0102d97:	e9 12 fa ff ff       	jmp    c01027ae <__alltraps>

c0102d9c <vector157>:
.globl vector157
vector157:
  pushl $0
c0102d9c:	6a 00                	push   $0x0
  pushl $157
c0102d9e:	68 9d 00 00 00       	push   $0x9d
  jmp __alltraps
c0102da3:	e9 06 fa ff ff       	jmp    c01027ae <__alltraps>

c0102da8 <vector158>:
.globl vector158
vector158:
  pushl $0
c0102da8:	6a 00                	push   $0x0
  pushl $158
c0102daa:	68 9e 00 00 00       	push   $0x9e
  jmp __alltraps
c0102daf:	e9 fa f9 ff ff       	jmp    c01027ae <__alltraps>

c0102db4 <vector159>:
.globl vector159
vector159:
  pushl $0
c0102db4:	6a 00                	push   $0x0
  pushl $159
c0102db6:	68 9f 00 00 00       	push   $0x9f
  jmp __alltraps
c0102dbb:	e9 ee f9 ff ff       	jmp    c01027ae <__alltraps>

c0102dc0 <vector160>:
.globl vector160
vector160:
  pushl $0
c0102dc0:	6a 00                	push   $0x0
  pushl $160
c0102dc2:	68 a0 00 00 00       	push   $0xa0
  jmp __alltraps
c0102dc7:	e9 e2 f9 ff ff       	jmp    c01027ae <__alltraps>

c0102dcc <vector161>:
.globl vector161
vector161:
  pushl $0
c0102dcc:	6a 00                	push   $0x0
  pushl $161
c0102dce:	68 a1 00 00 00       	push   $0xa1
  jmp __alltraps
c0102dd3:	e9 d6 f9 ff ff       	jmp    c01027ae <__alltraps>

c0102dd8 <vector162>:
.globl vector162
vector162:
  pushl $0
c0102dd8:	6a 00                	push   $0x0
  pushl $162
c0102dda:	68 a2 00 00 00       	push   $0xa2
  jmp __alltraps
c0102ddf:	e9 ca f9 ff ff       	jmp    c01027ae <__alltraps>

c0102de4 <vector163>:
.globl vector163
vector163:
  pushl $0
c0102de4:	6a 00                	push   $0x0
  pushl $163
c0102de6:	68 a3 00 00 00       	push   $0xa3
  jmp __alltraps
c0102deb:	e9 be f9 ff ff       	jmp    c01027ae <__alltraps>

c0102df0 <vector164>:
.globl vector164
vector164:
  pushl $0
c0102df0:	6a 00                	push   $0x0
  pushl $164
c0102df2:	68 a4 00 00 00       	push   $0xa4
  jmp __alltraps
c0102df7:	e9 b2 f9 ff ff       	jmp    c01027ae <__alltraps>

c0102dfc <vector165>:
.globl vector165
vector165:
  pushl $0
c0102dfc:	6a 00                	push   $0x0
  pushl $165
c0102dfe:	68 a5 00 00 00       	push   $0xa5
  jmp __alltraps
c0102e03:	e9 a6 f9 ff ff       	jmp    c01027ae <__alltraps>

c0102e08 <vector166>:
.globl vector166
vector166:
  pushl $0
c0102e08:	6a 00                	push   $0x0
  pushl $166
c0102e0a:	68 a6 00 00 00       	push   $0xa6
  jmp __alltraps
c0102e0f:	e9 9a f9 ff ff       	jmp    c01027ae <__alltraps>

c0102e14 <vector167>:
.globl vector167
vector167:
  pushl $0
c0102e14:	6a 00                	push   $0x0
  pushl $167
c0102e16:	68 a7 00 00 00       	push   $0xa7
  jmp __alltraps
c0102e1b:	e9 8e f9 ff ff       	jmp    c01027ae <__alltraps>

c0102e20 <vector168>:
.globl vector168
vector168:
  pushl $0
c0102e20:	6a 00                	push   $0x0
  pushl $168
c0102e22:	68 a8 00 00 00       	push   $0xa8
  jmp __alltraps
c0102e27:	e9 82 f9 ff ff       	jmp    c01027ae <__alltraps>

c0102e2c <vector169>:
.globl vector169
vector169:
  pushl $0
c0102e2c:	6a 00                	push   $0x0
  pushl $169
c0102e2e:	68 a9 00 00 00       	push   $0xa9
  jmp __alltraps
c0102e33:	e9 76 f9 ff ff       	jmp    c01027ae <__alltraps>

c0102e38 <vector170>:
.globl vector170
vector170:
  pushl $0
c0102e38:	6a 00                	push   $0x0
  pushl $170
c0102e3a:	68 aa 00 00 00       	push   $0xaa
  jmp __alltraps
c0102e3f:	e9 6a f9 ff ff       	jmp    c01027ae <__alltraps>

c0102e44 <vector171>:
.globl vector171
vector171:
  pushl $0
c0102e44:	6a 00                	push   $0x0
  pushl $171
c0102e46:	68 ab 00 00 00       	push   $0xab
  jmp __alltraps
c0102e4b:	e9 5e f9 ff ff       	jmp    c01027ae <__alltraps>

c0102e50 <vector172>:
.globl vector172
vector172:
  pushl $0
c0102e50:	6a 00                	push   $0x0
  pushl $172
c0102e52:	68 ac 00 00 00       	push   $0xac
  jmp __alltraps
c0102e57:	e9 52 f9 ff ff       	jmp    c01027ae <__alltraps>

c0102e5c <vector173>:
.globl vector173
vector173:
  pushl $0
c0102e5c:	6a 00                	push   $0x0
  pushl $173
c0102e5e:	68 ad 00 00 00       	push   $0xad
  jmp __alltraps
c0102e63:	e9 46 f9 ff ff       	jmp    c01027ae <__alltraps>

c0102e68 <vector174>:
.globl vector174
vector174:
  pushl $0
c0102e68:	6a 00                	push   $0x0
  pushl $174
c0102e6a:	68 ae 00 00 00       	push   $0xae
  jmp __alltraps
c0102e6f:	e9 3a f9 ff ff       	jmp    c01027ae <__alltraps>

c0102e74 <vector175>:
.globl vector175
vector175:
  pushl $0
c0102e74:	6a 00                	push   $0x0
  pushl $175
c0102e76:	68 af 00 00 00       	push   $0xaf
  jmp __alltraps
c0102e7b:	e9 2e f9 ff ff       	jmp    c01027ae <__alltraps>

c0102e80 <vector176>:
.globl vector176
vector176:
  pushl $0
c0102e80:	6a 00                	push   $0x0
  pushl $176
c0102e82:	68 b0 00 00 00       	push   $0xb0
  jmp __alltraps
c0102e87:	e9 22 f9 ff ff       	jmp    c01027ae <__alltraps>

c0102e8c <vector177>:
.globl vector177
vector177:
  pushl $0
c0102e8c:	6a 00                	push   $0x0
  pushl $177
c0102e8e:	68 b1 00 00 00       	push   $0xb1
  jmp __alltraps
c0102e93:	e9 16 f9 ff ff       	jmp    c01027ae <__alltraps>

c0102e98 <vector178>:
.globl vector178
vector178:
  pushl $0
c0102e98:	6a 00                	push   $0x0
  pushl $178
c0102e9a:	68 b2 00 00 00       	push   $0xb2
  jmp __alltraps
c0102e9f:	e9 0a f9 ff ff       	jmp    c01027ae <__alltraps>

c0102ea4 <vector179>:
.globl vector179
vector179:
  pushl $0
c0102ea4:	6a 00                	push   $0x0
  pushl $179
c0102ea6:	68 b3 00 00 00       	push   $0xb3
  jmp __alltraps
c0102eab:	e9 fe f8 ff ff       	jmp    c01027ae <__alltraps>

c0102eb0 <vector180>:
.globl vector180
vector180:
  pushl $0
c0102eb0:	6a 00                	push   $0x0
  pushl $180
c0102eb2:	68 b4 00 00 00       	push   $0xb4
  jmp __alltraps
c0102eb7:	e9 f2 f8 ff ff       	jmp    c01027ae <__alltraps>

c0102ebc <vector181>:
.globl vector181
vector181:
  pushl $0
c0102ebc:	6a 00                	push   $0x0
  pushl $181
c0102ebe:	68 b5 00 00 00       	push   $0xb5
  jmp __alltraps
c0102ec3:	e9 e6 f8 ff ff       	jmp    c01027ae <__alltraps>

c0102ec8 <vector182>:
.globl vector182
vector182:
  pushl $0
c0102ec8:	6a 00                	push   $0x0
  pushl $182
c0102eca:	68 b6 00 00 00       	push   $0xb6
  jmp __alltraps
c0102ecf:	e9 da f8 ff ff       	jmp    c01027ae <__alltraps>

c0102ed4 <vector183>:
.globl vector183
vector183:
  pushl $0
c0102ed4:	6a 00                	push   $0x0
  pushl $183
c0102ed6:	68 b7 00 00 00       	push   $0xb7
  jmp __alltraps
c0102edb:	e9 ce f8 ff ff       	jmp    c01027ae <__alltraps>

c0102ee0 <vector184>:
.globl vector184
vector184:
  pushl $0
c0102ee0:	6a 00                	push   $0x0
  pushl $184
c0102ee2:	68 b8 00 00 00       	push   $0xb8
  jmp __alltraps
c0102ee7:	e9 c2 f8 ff ff       	jmp    c01027ae <__alltraps>

c0102eec <vector185>:
.globl vector185
vector185:
  pushl $0
c0102eec:	6a 00                	push   $0x0
  pushl $185
c0102eee:	68 b9 00 00 00       	push   $0xb9
  jmp __alltraps
c0102ef3:	e9 b6 f8 ff ff       	jmp    c01027ae <__alltraps>

c0102ef8 <vector186>:
.globl vector186
vector186:
  pushl $0
c0102ef8:	6a 00                	push   $0x0
  pushl $186
c0102efa:	68 ba 00 00 00       	push   $0xba
  jmp __alltraps
c0102eff:	e9 aa f8 ff ff       	jmp    c01027ae <__alltraps>

c0102f04 <vector187>:
.globl vector187
vector187:
  pushl $0
c0102f04:	6a 00                	push   $0x0
  pushl $187
c0102f06:	68 bb 00 00 00       	push   $0xbb
  jmp __alltraps
c0102f0b:	e9 9e f8 ff ff       	jmp    c01027ae <__alltraps>

c0102f10 <vector188>:
.globl vector188
vector188:
  pushl $0
c0102f10:	6a 00                	push   $0x0
  pushl $188
c0102f12:	68 bc 00 00 00       	push   $0xbc
  jmp __alltraps
c0102f17:	e9 92 f8 ff ff       	jmp    c01027ae <__alltraps>

c0102f1c <vector189>:
.globl vector189
vector189:
  pushl $0
c0102f1c:	6a 00                	push   $0x0
  pushl $189
c0102f1e:	68 bd 00 00 00       	push   $0xbd
  jmp __alltraps
c0102f23:	e9 86 f8 ff ff       	jmp    c01027ae <__alltraps>

c0102f28 <vector190>:
.globl vector190
vector190:
  pushl $0
c0102f28:	6a 00                	push   $0x0
  pushl $190
c0102f2a:	68 be 00 00 00       	push   $0xbe
  jmp __alltraps
c0102f2f:	e9 7a f8 ff ff       	jmp    c01027ae <__alltraps>

c0102f34 <vector191>:
.globl vector191
vector191:
  pushl $0
c0102f34:	6a 00                	push   $0x0
  pushl $191
c0102f36:	68 bf 00 00 00       	push   $0xbf
  jmp __alltraps
c0102f3b:	e9 6e f8 ff ff       	jmp    c01027ae <__alltraps>

c0102f40 <vector192>:
.globl vector192
vector192:
  pushl $0
c0102f40:	6a 00                	push   $0x0
  pushl $192
c0102f42:	68 c0 00 00 00       	push   $0xc0
  jmp __alltraps
c0102f47:	e9 62 f8 ff ff       	jmp    c01027ae <__alltraps>

c0102f4c <vector193>:
.globl vector193
vector193:
  pushl $0
c0102f4c:	6a 00                	push   $0x0
  pushl $193
c0102f4e:	68 c1 00 00 00       	push   $0xc1
  jmp __alltraps
c0102f53:	e9 56 f8 ff ff       	jmp    c01027ae <__alltraps>

c0102f58 <vector194>:
.globl vector194
vector194:
  pushl $0
c0102f58:	6a 00                	push   $0x0
  pushl $194
c0102f5a:	68 c2 00 00 00       	push   $0xc2
  jmp __alltraps
c0102f5f:	e9 4a f8 ff ff       	jmp    c01027ae <__alltraps>

c0102f64 <vector195>:
.globl vector195
vector195:
  pushl $0
c0102f64:	6a 00                	push   $0x0
  pushl $195
c0102f66:	68 c3 00 00 00       	push   $0xc3
  jmp __alltraps
c0102f6b:	e9 3e f8 ff ff       	jmp    c01027ae <__alltraps>

c0102f70 <vector196>:
.globl vector196
vector196:
  pushl $0
c0102f70:	6a 00                	push   $0x0
  pushl $196
c0102f72:	68 c4 00 00 00       	push   $0xc4
  jmp __alltraps
c0102f77:	e9 32 f8 ff ff       	jmp    c01027ae <__alltraps>

c0102f7c <vector197>:
.globl vector197
vector197:
  pushl $0
c0102f7c:	6a 00                	push   $0x0
  pushl $197
c0102f7e:	68 c5 00 00 00       	push   $0xc5
  jmp __alltraps
c0102f83:	e9 26 f8 ff ff       	jmp    c01027ae <__alltraps>

c0102f88 <vector198>:
.globl vector198
vector198:
  pushl $0
c0102f88:	6a 00                	push   $0x0
  pushl $198
c0102f8a:	68 c6 00 00 00       	push   $0xc6
  jmp __alltraps
c0102f8f:	e9 1a f8 ff ff       	jmp    c01027ae <__alltraps>

c0102f94 <vector199>:
.globl vector199
vector199:
  pushl $0
c0102f94:	6a 00                	push   $0x0
  pushl $199
c0102f96:	68 c7 00 00 00       	push   $0xc7
  jmp __alltraps
c0102f9b:	e9 0e f8 ff ff       	jmp    c01027ae <__alltraps>

c0102fa0 <vector200>:
.globl vector200
vector200:
  pushl $0
c0102fa0:	6a 00                	push   $0x0
  pushl $200
c0102fa2:	68 c8 00 00 00       	push   $0xc8
  jmp __alltraps
c0102fa7:	e9 02 f8 ff ff       	jmp    c01027ae <__alltraps>

c0102fac <vector201>:
.globl vector201
vector201:
  pushl $0
c0102fac:	6a 00                	push   $0x0
  pushl $201
c0102fae:	68 c9 00 00 00       	push   $0xc9
  jmp __alltraps
c0102fb3:	e9 f6 f7 ff ff       	jmp    c01027ae <__alltraps>

c0102fb8 <vector202>:
.globl vector202
vector202:
  pushl $0
c0102fb8:	6a 00                	push   $0x0
  pushl $202
c0102fba:	68 ca 00 00 00       	push   $0xca
  jmp __alltraps
c0102fbf:	e9 ea f7 ff ff       	jmp    c01027ae <__alltraps>

c0102fc4 <vector203>:
.globl vector203
vector203:
  pushl $0
c0102fc4:	6a 00                	push   $0x0
  pushl $203
c0102fc6:	68 cb 00 00 00       	push   $0xcb
  jmp __alltraps
c0102fcb:	e9 de f7 ff ff       	jmp    c01027ae <__alltraps>

c0102fd0 <vector204>:
.globl vector204
vector204:
  pushl $0
c0102fd0:	6a 00                	push   $0x0
  pushl $204
c0102fd2:	68 cc 00 00 00       	push   $0xcc
  jmp __alltraps
c0102fd7:	e9 d2 f7 ff ff       	jmp    c01027ae <__alltraps>

c0102fdc <vector205>:
.globl vector205
vector205:
  pushl $0
c0102fdc:	6a 00                	push   $0x0
  pushl $205
c0102fde:	68 cd 00 00 00       	push   $0xcd
  jmp __alltraps
c0102fe3:	e9 c6 f7 ff ff       	jmp    c01027ae <__alltraps>

c0102fe8 <vector206>:
.globl vector206
vector206:
  pushl $0
c0102fe8:	6a 00                	push   $0x0
  pushl $206
c0102fea:	68 ce 00 00 00       	push   $0xce
  jmp __alltraps
c0102fef:	e9 ba f7 ff ff       	jmp    c01027ae <__alltraps>

c0102ff4 <vector207>:
.globl vector207
vector207:
  pushl $0
c0102ff4:	6a 00                	push   $0x0
  pushl $207
c0102ff6:	68 cf 00 00 00       	push   $0xcf
  jmp __alltraps
c0102ffb:	e9 ae f7 ff ff       	jmp    c01027ae <__alltraps>

c0103000 <vector208>:
.globl vector208
vector208:
  pushl $0
c0103000:	6a 00                	push   $0x0
  pushl $208
c0103002:	68 d0 00 00 00       	push   $0xd0
  jmp __alltraps
c0103007:	e9 a2 f7 ff ff       	jmp    c01027ae <__alltraps>

c010300c <vector209>:
.globl vector209
vector209:
  pushl $0
c010300c:	6a 00                	push   $0x0
  pushl $209
c010300e:	68 d1 00 00 00       	push   $0xd1
  jmp __alltraps
c0103013:	e9 96 f7 ff ff       	jmp    c01027ae <__alltraps>

c0103018 <vector210>:
.globl vector210
vector210:
  pushl $0
c0103018:	6a 00                	push   $0x0
  pushl $210
c010301a:	68 d2 00 00 00       	push   $0xd2
  jmp __alltraps
c010301f:	e9 8a f7 ff ff       	jmp    c01027ae <__alltraps>

c0103024 <vector211>:
.globl vector211
vector211:
  pushl $0
c0103024:	6a 00                	push   $0x0
  pushl $211
c0103026:	68 d3 00 00 00       	push   $0xd3
  jmp __alltraps
c010302b:	e9 7e f7 ff ff       	jmp    c01027ae <__alltraps>

c0103030 <vector212>:
.globl vector212
vector212:
  pushl $0
c0103030:	6a 00                	push   $0x0
  pushl $212
c0103032:	68 d4 00 00 00       	push   $0xd4
  jmp __alltraps
c0103037:	e9 72 f7 ff ff       	jmp    c01027ae <__alltraps>

c010303c <vector213>:
.globl vector213
vector213:
  pushl $0
c010303c:	6a 00                	push   $0x0
  pushl $213
c010303e:	68 d5 00 00 00       	push   $0xd5
  jmp __alltraps
c0103043:	e9 66 f7 ff ff       	jmp    c01027ae <__alltraps>

c0103048 <vector214>:
.globl vector214
vector214:
  pushl $0
c0103048:	6a 00                	push   $0x0
  pushl $214
c010304a:	68 d6 00 00 00       	push   $0xd6
  jmp __alltraps
c010304f:	e9 5a f7 ff ff       	jmp    c01027ae <__alltraps>

c0103054 <vector215>:
.globl vector215
vector215:
  pushl $0
c0103054:	6a 00                	push   $0x0
  pushl $215
c0103056:	68 d7 00 00 00       	push   $0xd7
  jmp __alltraps
c010305b:	e9 4e f7 ff ff       	jmp    c01027ae <__alltraps>

c0103060 <vector216>:
.globl vector216
vector216:
  pushl $0
c0103060:	6a 00                	push   $0x0
  pushl $216
c0103062:	68 d8 00 00 00       	push   $0xd8
  jmp __alltraps
c0103067:	e9 42 f7 ff ff       	jmp    c01027ae <__alltraps>

c010306c <vector217>:
.globl vector217
vector217:
  pushl $0
c010306c:	6a 00                	push   $0x0
  pushl $217
c010306e:	68 d9 00 00 00       	push   $0xd9
  jmp __alltraps
c0103073:	e9 36 f7 ff ff       	jmp    c01027ae <__alltraps>

c0103078 <vector218>:
.globl vector218
vector218:
  pushl $0
c0103078:	6a 00                	push   $0x0
  pushl $218
c010307a:	68 da 00 00 00       	push   $0xda
  jmp __alltraps
c010307f:	e9 2a f7 ff ff       	jmp    c01027ae <__alltraps>

c0103084 <vector219>:
.globl vector219
vector219:
  pushl $0
c0103084:	6a 00                	push   $0x0
  pushl $219
c0103086:	68 db 00 00 00       	push   $0xdb
  jmp __alltraps
c010308b:	e9 1e f7 ff ff       	jmp    c01027ae <__alltraps>

c0103090 <vector220>:
.globl vector220
vector220:
  pushl $0
c0103090:	6a 00                	push   $0x0
  pushl $220
c0103092:	68 dc 00 00 00       	push   $0xdc
  jmp __alltraps
c0103097:	e9 12 f7 ff ff       	jmp    c01027ae <__alltraps>

c010309c <vector221>:
.globl vector221
vector221:
  pushl $0
c010309c:	6a 00                	push   $0x0
  pushl $221
c010309e:	68 dd 00 00 00       	push   $0xdd
  jmp __alltraps
c01030a3:	e9 06 f7 ff ff       	jmp    c01027ae <__alltraps>

c01030a8 <vector222>:
.globl vector222
vector222:
  pushl $0
c01030a8:	6a 00                	push   $0x0
  pushl $222
c01030aa:	68 de 00 00 00       	push   $0xde
  jmp __alltraps
c01030af:	e9 fa f6 ff ff       	jmp    c01027ae <__alltraps>

c01030b4 <vector223>:
.globl vector223
vector223:
  pushl $0
c01030b4:	6a 00                	push   $0x0
  pushl $223
c01030b6:	68 df 00 00 00       	push   $0xdf
  jmp __alltraps
c01030bb:	e9 ee f6 ff ff       	jmp    c01027ae <__alltraps>

c01030c0 <vector224>:
.globl vector224
vector224:
  pushl $0
c01030c0:	6a 00                	push   $0x0
  pushl $224
c01030c2:	68 e0 00 00 00       	push   $0xe0
  jmp __alltraps
c01030c7:	e9 e2 f6 ff ff       	jmp    c01027ae <__alltraps>

c01030cc <vector225>:
.globl vector225
vector225:
  pushl $0
c01030cc:	6a 00                	push   $0x0
  pushl $225
c01030ce:	68 e1 00 00 00       	push   $0xe1
  jmp __alltraps
c01030d3:	e9 d6 f6 ff ff       	jmp    c01027ae <__alltraps>

c01030d8 <vector226>:
.globl vector226
vector226:
  pushl $0
c01030d8:	6a 00                	push   $0x0
  pushl $226
c01030da:	68 e2 00 00 00       	push   $0xe2
  jmp __alltraps
c01030df:	e9 ca f6 ff ff       	jmp    c01027ae <__alltraps>

c01030e4 <vector227>:
.globl vector227
vector227:
  pushl $0
c01030e4:	6a 00                	push   $0x0
  pushl $227
c01030e6:	68 e3 00 00 00       	push   $0xe3
  jmp __alltraps
c01030eb:	e9 be f6 ff ff       	jmp    c01027ae <__alltraps>

c01030f0 <vector228>:
.globl vector228
vector228:
  pushl $0
c01030f0:	6a 00                	push   $0x0
  pushl $228
c01030f2:	68 e4 00 00 00       	push   $0xe4
  jmp __alltraps
c01030f7:	e9 b2 f6 ff ff       	jmp    c01027ae <__alltraps>

c01030fc <vector229>:
.globl vector229
vector229:
  pushl $0
c01030fc:	6a 00                	push   $0x0
  pushl $229
c01030fe:	68 e5 00 00 00       	push   $0xe5
  jmp __alltraps
c0103103:	e9 a6 f6 ff ff       	jmp    c01027ae <__alltraps>

c0103108 <vector230>:
.globl vector230
vector230:
  pushl $0
c0103108:	6a 00                	push   $0x0
  pushl $230
c010310a:	68 e6 00 00 00       	push   $0xe6
  jmp __alltraps
c010310f:	e9 9a f6 ff ff       	jmp    c01027ae <__alltraps>

c0103114 <vector231>:
.globl vector231
vector231:
  pushl $0
c0103114:	6a 00                	push   $0x0
  pushl $231
c0103116:	68 e7 00 00 00       	push   $0xe7
  jmp __alltraps
c010311b:	e9 8e f6 ff ff       	jmp    c01027ae <__alltraps>

c0103120 <vector232>:
.globl vector232
vector232:
  pushl $0
c0103120:	6a 00                	push   $0x0
  pushl $232
c0103122:	68 e8 00 00 00       	push   $0xe8
  jmp __alltraps
c0103127:	e9 82 f6 ff ff       	jmp    c01027ae <__alltraps>

c010312c <vector233>:
.globl vector233
vector233:
  pushl $0
c010312c:	6a 00                	push   $0x0
  pushl $233
c010312e:	68 e9 00 00 00       	push   $0xe9
  jmp __alltraps
c0103133:	e9 76 f6 ff ff       	jmp    c01027ae <__alltraps>

c0103138 <vector234>:
.globl vector234
vector234:
  pushl $0
c0103138:	6a 00                	push   $0x0
  pushl $234
c010313a:	68 ea 00 00 00       	push   $0xea
  jmp __alltraps
c010313f:	e9 6a f6 ff ff       	jmp    c01027ae <__alltraps>

c0103144 <vector235>:
.globl vector235
vector235:
  pushl $0
c0103144:	6a 00                	push   $0x0
  pushl $235
c0103146:	68 eb 00 00 00       	push   $0xeb
  jmp __alltraps
c010314b:	e9 5e f6 ff ff       	jmp    c01027ae <__alltraps>

c0103150 <vector236>:
.globl vector236
vector236:
  pushl $0
c0103150:	6a 00                	push   $0x0
  pushl $236
c0103152:	68 ec 00 00 00       	push   $0xec
  jmp __alltraps
c0103157:	e9 52 f6 ff ff       	jmp    c01027ae <__alltraps>

c010315c <vector237>:
.globl vector237
vector237:
  pushl $0
c010315c:	6a 00                	push   $0x0
  pushl $237
c010315e:	68 ed 00 00 00       	push   $0xed
  jmp __alltraps
c0103163:	e9 46 f6 ff ff       	jmp    c01027ae <__alltraps>

c0103168 <vector238>:
.globl vector238
vector238:
  pushl $0
c0103168:	6a 00                	push   $0x0
  pushl $238
c010316a:	68 ee 00 00 00       	push   $0xee
  jmp __alltraps
c010316f:	e9 3a f6 ff ff       	jmp    c01027ae <__alltraps>

c0103174 <vector239>:
.globl vector239
vector239:
  pushl $0
c0103174:	6a 00                	push   $0x0
  pushl $239
c0103176:	68 ef 00 00 00       	push   $0xef
  jmp __alltraps
c010317b:	e9 2e f6 ff ff       	jmp    c01027ae <__alltraps>

c0103180 <vector240>:
.globl vector240
vector240:
  pushl $0
c0103180:	6a 00                	push   $0x0
  pushl $240
c0103182:	68 f0 00 00 00       	push   $0xf0
  jmp __alltraps
c0103187:	e9 22 f6 ff ff       	jmp    c01027ae <__alltraps>

c010318c <vector241>:
.globl vector241
vector241:
  pushl $0
c010318c:	6a 00                	push   $0x0
  pushl $241
c010318e:	68 f1 00 00 00       	push   $0xf1
  jmp __alltraps
c0103193:	e9 16 f6 ff ff       	jmp    c01027ae <__alltraps>

c0103198 <vector242>:
.globl vector242
vector242:
  pushl $0
c0103198:	6a 00                	push   $0x0
  pushl $242
c010319a:	68 f2 00 00 00       	push   $0xf2
  jmp __alltraps
c010319f:	e9 0a f6 ff ff       	jmp    c01027ae <__alltraps>

c01031a4 <vector243>:
.globl vector243
vector243:
  pushl $0
c01031a4:	6a 00                	push   $0x0
  pushl $243
c01031a6:	68 f3 00 00 00       	push   $0xf3
  jmp __alltraps
c01031ab:	e9 fe f5 ff ff       	jmp    c01027ae <__alltraps>

c01031b0 <vector244>:
.globl vector244
vector244:
  pushl $0
c01031b0:	6a 00                	push   $0x0
  pushl $244
c01031b2:	68 f4 00 00 00       	push   $0xf4
  jmp __alltraps
c01031b7:	e9 f2 f5 ff ff       	jmp    c01027ae <__alltraps>

c01031bc <vector245>:
.globl vector245
vector245:
  pushl $0
c01031bc:	6a 00                	push   $0x0
  pushl $245
c01031be:	68 f5 00 00 00       	push   $0xf5
  jmp __alltraps
c01031c3:	e9 e6 f5 ff ff       	jmp    c01027ae <__alltraps>

c01031c8 <vector246>:
.globl vector246
vector246:
  pushl $0
c01031c8:	6a 00                	push   $0x0
  pushl $246
c01031ca:	68 f6 00 00 00       	push   $0xf6
  jmp __alltraps
c01031cf:	e9 da f5 ff ff       	jmp    c01027ae <__alltraps>

c01031d4 <vector247>:
.globl vector247
vector247:
  pushl $0
c01031d4:	6a 00                	push   $0x0
  pushl $247
c01031d6:	68 f7 00 00 00       	push   $0xf7
  jmp __alltraps
c01031db:	e9 ce f5 ff ff       	jmp    c01027ae <__alltraps>

c01031e0 <vector248>:
.globl vector248
vector248:
  pushl $0
c01031e0:	6a 00                	push   $0x0
  pushl $248
c01031e2:	68 f8 00 00 00       	push   $0xf8
  jmp __alltraps
c01031e7:	e9 c2 f5 ff ff       	jmp    c01027ae <__alltraps>

c01031ec <vector249>:
.globl vector249
vector249:
  pushl $0
c01031ec:	6a 00                	push   $0x0
  pushl $249
c01031ee:	68 f9 00 00 00       	push   $0xf9
  jmp __alltraps
c01031f3:	e9 b6 f5 ff ff       	jmp    c01027ae <__alltraps>

c01031f8 <vector250>:
.globl vector250
vector250:
  pushl $0
c01031f8:	6a 00                	push   $0x0
  pushl $250
c01031fa:	68 fa 00 00 00       	push   $0xfa
  jmp __alltraps
c01031ff:	e9 aa f5 ff ff       	jmp    c01027ae <__alltraps>

c0103204 <vector251>:
.globl vector251
vector251:
  pushl $0
c0103204:	6a 00                	push   $0x0
  pushl $251
c0103206:	68 fb 00 00 00       	push   $0xfb
  jmp __alltraps
c010320b:	e9 9e f5 ff ff       	jmp    c01027ae <__alltraps>

c0103210 <vector252>:
.globl vector252
vector252:
  pushl $0
c0103210:	6a 00                	push   $0x0
  pushl $252
c0103212:	68 fc 00 00 00       	push   $0xfc
  jmp __alltraps
c0103217:	e9 92 f5 ff ff       	jmp    c01027ae <__alltraps>

c010321c <vector253>:
.globl vector253
vector253:
  pushl $0
c010321c:	6a 00                	push   $0x0
  pushl $253
c010321e:	68 fd 00 00 00       	push   $0xfd
  jmp __alltraps
c0103223:	e9 86 f5 ff ff       	jmp    c01027ae <__alltraps>

c0103228 <vector254>:
.globl vector254
vector254:
  pushl $0
c0103228:	6a 00                	push   $0x0
  pushl $254
c010322a:	68 fe 00 00 00       	push   $0xfe
  jmp __alltraps
c010322f:	e9 7a f5 ff ff       	jmp    c01027ae <__alltraps>

c0103234 <vector255>:
.globl vector255
vector255:
  pushl $0
c0103234:	6a 00                	push   $0x0
  pushl $255
c0103236:	68 ff 00 00 00       	push   $0xff
  jmp __alltraps
c010323b:	e9 6e f5 ff ff       	jmp    c01027ae <__alltraps>

c0103240 <page2ppn>:

extern struct Page *pages;
extern size_t npage;

static inline ppn_t
page2ppn(struct Page *page) {
c0103240:	55                   	push   %ebp
c0103241:	89 e5                	mov    %esp,%ebp
    return page - pages;
c0103243:	8b 55 08             	mov    0x8(%ebp),%edx
c0103246:	a1 d4 1a 12 c0       	mov    0xc0121ad4,%eax
c010324b:	29 c2                	sub    %eax,%edx
c010324d:	89 d0                	mov    %edx,%eax
c010324f:	c1 f8 05             	sar    $0x5,%eax
}
c0103252:	5d                   	pop    %ebp
c0103253:	c3                   	ret    

c0103254 <page2pa>:

static inline uintptr_t
page2pa(struct Page *page) {
c0103254:	55                   	push   %ebp
c0103255:	89 e5                	mov    %esp,%ebp
c0103257:	83 ec 04             	sub    $0x4,%esp
    return page2ppn(page) << PGSHIFT;
c010325a:	8b 45 08             	mov    0x8(%ebp),%eax
c010325d:	89 04 24             	mov    %eax,(%esp)
c0103260:	e8 db ff ff ff       	call   c0103240 <page2ppn>
c0103265:	c1 e0 0c             	shl    $0xc,%eax
}
c0103268:	c9                   	leave  
c0103269:	c3                   	ret    

c010326a <page_ref>:
pde2page(pde_t pde) {
    return pa2page(PDE_ADDR(pde));
}

static inline int
page_ref(struct Page *page) {
c010326a:	55                   	push   %ebp
c010326b:	89 e5                	mov    %esp,%ebp
    return page->ref;
c010326d:	8b 45 08             	mov    0x8(%ebp),%eax
c0103270:	8b 00                	mov    (%eax),%eax
}
c0103272:	5d                   	pop    %ebp
c0103273:	c3                   	ret    

c0103274 <set_page_ref>:

static inline void
set_page_ref(struct Page *page, int val) {
c0103274:	55                   	push   %ebp
c0103275:	89 e5                	mov    %esp,%ebp
    page->ref = val;
c0103277:	8b 45 08             	mov    0x8(%ebp),%eax
c010327a:	8b 55 0c             	mov    0xc(%ebp),%edx
c010327d:	89 10                	mov    %edx,(%eax)
}
c010327f:	5d                   	pop    %ebp
c0103280:	c3                   	ret    

c0103281 <default_init>:

#define free_list (free_area.free_list)
#define nr_free (free_area.nr_free)

static void
default_init(void) {
c0103281:	55                   	push   %ebp
c0103282:	89 e5                	mov    %esp,%ebp
c0103284:	83 ec 10             	sub    $0x10,%esp
c0103287:	c7 45 fc c0 1a 12 c0 	movl   $0xc0121ac0,-0x4(%ebp)
 * list_init - initialize a new entry
 * @elm:        new entry to be initialized
 * */
static inline void
list_init(list_entry_t *elm) {
    elm->prev = elm->next = elm;
c010328e:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0103291:	8b 55 fc             	mov    -0x4(%ebp),%edx
c0103294:	89 50 04             	mov    %edx,0x4(%eax)
c0103297:	8b 45 fc             	mov    -0x4(%ebp),%eax
c010329a:	8b 50 04             	mov    0x4(%eax),%edx
c010329d:	8b 45 fc             	mov    -0x4(%ebp),%eax
c01032a0:	89 10                	mov    %edx,(%eax)
    list_init(&free_list);
    nr_free = 0;
c01032a2:	c7 05 c8 1a 12 c0 00 	movl   $0x0,0xc0121ac8
c01032a9:	00 00 00 
}
c01032ac:	c9                   	leave  
c01032ad:	c3                   	ret    

c01032ae <default_init_memmap>:

static void
default_init_memmap(struct Page *base, size_t n) {
c01032ae:	55                   	push   %ebp
c01032af:	89 e5                	mov    %esp,%ebp
c01032b1:	83 ec 48             	sub    $0x48,%esp
    assert(n > 0);
c01032b4:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
c01032b8:	75 24                	jne    c01032de <default_init_memmap+0x30>
c01032ba:	c7 44 24 0c 70 94 10 	movl   $0xc0109470,0xc(%esp)
c01032c1:	c0 
c01032c2:	c7 44 24 08 76 94 10 	movl   $0xc0109476,0x8(%esp)
c01032c9:	c0 
c01032ca:	c7 44 24 04 46 00 00 	movl   $0x46,0x4(%esp)
c01032d1:	00 
c01032d2:	c7 04 24 8b 94 10 c0 	movl   $0xc010948b,(%esp)
c01032d9:	e8 f7 d9 ff ff       	call   c0100cd5 <__panic>
    struct Page *p = base;
c01032de:	8b 45 08             	mov    0x8(%ebp),%eax
c01032e1:	89 45 f4             	mov    %eax,-0xc(%ebp)
    for (; p != base + n; p ++) {
c01032e4:	e9 dc 00 00 00       	jmp    c01033c5 <default_init_memmap+0x117>
        assert(PageReserved(p));
c01032e9:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01032ec:	83 c0 04             	add    $0x4,%eax
c01032ef:	c7 45 f0 00 00 00 00 	movl   $0x0,-0x10(%ebp)
c01032f6:	89 45 ec             	mov    %eax,-0x14(%ebp)
 * @addr:   the address to count from
 * */
static inline bool
test_bit(int nr, volatile void *addr) {
    int oldbit;
    asm volatile ("btl %2, %1; sbbl %0,%0" : "=r" (oldbit) : "m" (*(volatile long *)addr), "Ir" (nr));
c01032f9:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01032fc:	8b 55 f0             	mov    -0x10(%ebp),%edx
c01032ff:	0f a3 10             	bt     %edx,(%eax)
c0103302:	19 c0                	sbb    %eax,%eax
c0103304:	89 45 e8             	mov    %eax,-0x18(%ebp)
    return oldbit != 0;
c0103307:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
c010330b:	0f 95 c0             	setne  %al
c010330e:	0f b6 c0             	movzbl %al,%eax
c0103311:	85 c0                	test   %eax,%eax
c0103313:	75 24                	jne    c0103339 <default_init_memmap+0x8b>
c0103315:	c7 44 24 0c a1 94 10 	movl   $0xc01094a1,0xc(%esp)
c010331c:	c0 
c010331d:	c7 44 24 08 76 94 10 	movl   $0xc0109476,0x8(%esp)
c0103324:	c0 
c0103325:	c7 44 24 04 49 00 00 	movl   $0x49,0x4(%esp)
c010332c:	00 
c010332d:	c7 04 24 8b 94 10 c0 	movl   $0xc010948b,(%esp)
c0103334:	e8 9c d9 ff ff       	call   c0100cd5 <__panic>
        p->flags = 0;
c0103339:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010333c:	c7 40 04 00 00 00 00 	movl   $0x0,0x4(%eax)
        SetPageProperty(p);
c0103343:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0103346:	83 c0 04             	add    $0x4,%eax
c0103349:	c7 45 e4 01 00 00 00 	movl   $0x1,-0x1c(%ebp)
c0103350:	89 45 e0             	mov    %eax,-0x20(%ebp)
 * Note that @nr may be almost arbitrarily large; this function is not
 * restricted to acting on a single-word quantity.
 * */
static inline void
set_bit(int nr, volatile void *addr) {
    asm volatile ("btsl %1, %0" :"=m" (*(volatile long *)addr) : "Ir" (nr));
c0103353:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0103356:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c0103359:	0f ab 10             	bts    %edx,(%eax)
        p->property = 0;
c010335c:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010335f:	c7 40 08 00 00 00 00 	movl   $0x0,0x8(%eax)
        set_page_ref(p, 0);
c0103366:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c010336d:	00 
c010336e:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0103371:	89 04 24             	mov    %eax,(%esp)
c0103374:	e8 fb fe ff ff       	call   c0103274 <set_page_ref>
        list_add_before(&free_list, &(p->page_link));
c0103379:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010337c:	83 c0 0c             	add    $0xc,%eax
c010337f:	c7 45 dc c0 1a 12 c0 	movl   $0xc0121ac0,-0x24(%ebp)
c0103386:	89 45 d8             	mov    %eax,-0x28(%ebp)
 * Insert the new element @elm *before* the element @listelm which
 * is already in the list.
 * */
static inline void
list_add_before(list_entry_t *listelm, list_entry_t *elm) {
    __list_add(elm, listelm->prev, listelm);
c0103389:	8b 45 dc             	mov    -0x24(%ebp),%eax
c010338c:	8b 00                	mov    (%eax),%eax
c010338e:	8b 55 d8             	mov    -0x28(%ebp),%edx
c0103391:	89 55 d4             	mov    %edx,-0x2c(%ebp)
c0103394:	89 45 d0             	mov    %eax,-0x30(%ebp)
c0103397:	8b 45 dc             	mov    -0x24(%ebp),%eax
c010339a:	89 45 cc             	mov    %eax,-0x34(%ebp)
 * This is only for internal list manipulation where we know
 * the prev/next entries already!
 * */
static inline void
__list_add(list_entry_t *elm, list_entry_t *prev, list_entry_t *next) {
    prev->next = next->prev = elm;
c010339d:	8b 45 cc             	mov    -0x34(%ebp),%eax
c01033a0:	8b 55 d4             	mov    -0x2c(%ebp),%edx
c01033a3:	89 10                	mov    %edx,(%eax)
c01033a5:	8b 45 cc             	mov    -0x34(%ebp),%eax
c01033a8:	8b 10                	mov    (%eax),%edx
c01033aa:	8b 45 d0             	mov    -0x30(%ebp),%eax
c01033ad:	89 50 04             	mov    %edx,0x4(%eax)
    elm->next = next;
c01033b0:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c01033b3:	8b 55 cc             	mov    -0x34(%ebp),%edx
c01033b6:	89 50 04             	mov    %edx,0x4(%eax)
    elm->prev = prev;
c01033b9:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c01033bc:	8b 55 d0             	mov    -0x30(%ebp),%edx
c01033bf:	89 10                	mov    %edx,(%eax)

static void
default_init_memmap(struct Page *base, size_t n) {
    assert(n > 0);
    struct Page *p = base;
    for (; p != base + n; p ++) {
c01033c1:	83 45 f4 20          	addl   $0x20,-0xc(%ebp)
c01033c5:	8b 45 0c             	mov    0xc(%ebp),%eax
c01033c8:	c1 e0 05             	shl    $0x5,%eax
c01033cb:	89 c2                	mov    %eax,%edx
c01033cd:	8b 45 08             	mov    0x8(%ebp),%eax
c01033d0:	01 d0                	add    %edx,%eax
c01033d2:	3b 45 f4             	cmp    -0xc(%ebp),%eax
c01033d5:	0f 85 0e ff ff ff    	jne    c01032e9 <default_init_memmap+0x3b>
        SetPageProperty(p);
        p->property = 0;
        set_page_ref(p, 0);
        list_add_before(&free_list, &(p->page_link));
    }
    nr_free += n;
c01033db:	8b 15 c8 1a 12 c0    	mov    0xc0121ac8,%edx
c01033e1:	8b 45 0c             	mov    0xc(%ebp),%eax
c01033e4:	01 d0                	add    %edx,%eax
c01033e6:	a3 c8 1a 12 c0       	mov    %eax,0xc0121ac8
    //first block
    base->property = n;
c01033eb:	8b 45 08             	mov    0x8(%ebp),%eax
c01033ee:	8b 55 0c             	mov    0xc(%ebp),%edx
c01033f1:	89 50 08             	mov    %edx,0x8(%eax)
}
c01033f4:	c9                   	leave  
c01033f5:	c3                   	ret    

c01033f6 <default_alloc_pages>:

static struct Page *
default_alloc_pages(size_t n) {
c01033f6:	55                   	push   %ebp
c01033f7:	89 e5                	mov    %esp,%ebp
c01033f9:	83 ec 68             	sub    $0x68,%esp
    assert(n > 0);
c01033fc:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
c0103400:	75 24                	jne    c0103426 <default_alloc_pages+0x30>
c0103402:	c7 44 24 0c 70 94 10 	movl   $0xc0109470,0xc(%esp)
c0103409:	c0 
c010340a:	c7 44 24 08 76 94 10 	movl   $0xc0109476,0x8(%esp)
c0103411:	c0 
c0103412:	c7 44 24 04 57 00 00 	movl   $0x57,0x4(%esp)
c0103419:	00 
c010341a:	c7 04 24 8b 94 10 c0 	movl   $0xc010948b,(%esp)
c0103421:	e8 af d8 ff ff       	call   c0100cd5 <__panic>
    if (n > nr_free) {
c0103426:	a1 c8 1a 12 c0       	mov    0xc0121ac8,%eax
c010342b:	3b 45 08             	cmp    0x8(%ebp),%eax
c010342e:	73 0a                	jae    c010343a <default_alloc_pages+0x44>
        return NULL;
c0103430:	b8 00 00 00 00       	mov    $0x0,%eax
c0103435:	e9 37 01 00 00       	jmp    c0103571 <default_alloc_pages+0x17b>
    }
    list_entry_t *le, *len;
    le = &free_list;
c010343a:	c7 45 f4 c0 1a 12 c0 	movl   $0xc0121ac0,-0xc(%ebp)

    while((le=list_next(le)) != &free_list) {
c0103441:	e9 0a 01 00 00       	jmp    c0103550 <default_alloc_pages+0x15a>
      struct Page *p = le2page(le, page_link);
c0103446:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0103449:	83 e8 0c             	sub    $0xc,%eax
c010344c:	89 45 ec             	mov    %eax,-0x14(%ebp)
      if(p->property >= n){
c010344f:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0103452:	8b 40 08             	mov    0x8(%eax),%eax
c0103455:	3b 45 08             	cmp    0x8(%ebp),%eax
c0103458:	0f 82 f2 00 00 00    	jb     c0103550 <default_alloc_pages+0x15a>
        int i;
        for(i=0;i<n;i++){
c010345e:	c7 45 f0 00 00 00 00 	movl   $0x0,-0x10(%ebp)
c0103465:	eb 7c                	jmp    c01034e3 <default_alloc_pages+0xed>
c0103467:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010346a:	89 45 e0             	mov    %eax,-0x20(%ebp)
 * list_next - get the next entry
 * @listelm:    the list head
 **/
static inline list_entry_t *
list_next(list_entry_t *listelm) {
    return listelm->next;
c010346d:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0103470:	8b 40 04             	mov    0x4(%eax),%eax
          len = list_next(le);
c0103473:	89 45 e8             	mov    %eax,-0x18(%ebp)
          struct Page *pp = le2page(le, page_link);
c0103476:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0103479:	83 e8 0c             	sub    $0xc,%eax
c010347c:	89 45 e4             	mov    %eax,-0x1c(%ebp)
          SetPageReserved(pp);
c010347f:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0103482:	83 c0 04             	add    $0x4,%eax
c0103485:	c7 45 dc 00 00 00 00 	movl   $0x0,-0x24(%ebp)
c010348c:	89 45 d8             	mov    %eax,-0x28(%ebp)
c010348f:	8b 45 d8             	mov    -0x28(%ebp),%eax
c0103492:	8b 55 dc             	mov    -0x24(%ebp),%edx
c0103495:	0f ab 10             	bts    %edx,(%eax)
          ClearPageProperty(pp);
c0103498:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c010349b:	83 c0 04             	add    $0x4,%eax
c010349e:	c7 45 d4 01 00 00 00 	movl   $0x1,-0x2c(%ebp)
c01034a5:	89 45 d0             	mov    %eax,-0x30(%ebp)
 * @nr:     the bit to clear
 * @addr:   the address to start counting from
 * */
static inline void
clear_bit(int nr, volatile void *addr) {
    asm volatile ("btrl %1, %0" :"=m" (*(volatile long *)addr) : "Ir" (nr));
c01034a8:	8b 45 d0             	mov    -0x30(%ebp),%eax
c01034ab:	8b 55 d4             	mov    -0x2c(%ebp),%edx
c01034ae:	0f b3 10             	btr    %edx,(%eax)
c01034b1:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01034b4:	89 45 cc             	mov    %eax,-0x34(%ebp)
 * Note: list_empty() on @listelm does not return true after this, the entry is
 * in an undefined state.
 * */
static inline void
list_del(list_entry_t *listelm) {
    __list_del(listelm->prev, listelm->next);
c01034b7:	8b 45 cc             	mov    -0x34(%ebp),%eax
c01034ba:	8b 40 04             	mov    0x4(%eax),%eax
c01034bd:	8b 55 cc             	mov    -0x34(%ebp),%edx
c01034c0:	8b 12                	mov    (%edx),%edx
c01034c2:	89 55 c8             	mov    %edx,-0x38(%ebp)
c01034c5:	89 45 c4             	mov    %eax,-0x3c(%ebp)
 * This is only for internal list manipulation where we know
 * the prev/next entries already!
 * */
static inline void
__list_del(list_entry_t *prev, list_entry_t *next) {
    prev->next = next;
c01034c8:	8b 45 c8             	mov    -0x38(%ebp),%eax
c01034cb:	8b 55 c4             	mov    -0x3c(%ebp),%edx
c01034ce:	89 50 04             	mov    %edx,0x4(%eax)
    next->prev = prev;
c01034d1:	8b 45 c4             	mov    -0x3c(%ebp),%eax
c01034d4:	8b 55 c8             	mov    -0x38(%ebp),%edx
c01034d7:	89 10                	mov    %edx,(%eax)
          list_del(le);
          le = len;
c01034d9:	8b 45 e8             	mov    -0x18(%ebp),%eax
c01034dc:	89 45 f4             	mov    %eax,-0xc(%ebp)

    while((le=list_next(le)) != &free_list) {
      struct Page *p = le2page(le, page_link);
      if(p->property >= n){
        int i;
        for(i=0;i<n;i++){
c01034df:	83 45 f0 01          	addl   $0x1,-0x10(%ebp)
c01034e3:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01034e6:	3b 45 08             	cmp    0x8(%ebp),%eax
c01034e9:	0f 82 78 ff ff ff    	jb     c0103467 <default_alloc_pages+0x71>
          SetPageReserved(pp);
          ClearPageProperty(pp);
          list_del(le);
          le = len;
        }
        if(p->property>n){
c01034ef:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01034f2:	8b 40 08             	mov    0x8(%eax),%eax
c01034f5:	3b 45 08             	cmp    0x8(%ebp),%eax
c01034f8:	76 12                	jbe    c010350c <default_alloc_pages+0x116>
          (le2page(le,page_link))->property = p->property - n;
c01034fa:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01034fd:	8d 50 f4             	lea    -0xc(%eax),%edx
c0103500:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0103503:	8b 40 08             	mov    0x8(%eax),%eax
c0103506:	2b 45 08             	sub    0x8(%ebp),%eax
c0103509:	89 42 08             	mov    %eax,0x8(%edx)
        }
        ClearPageProperty(p);
c010350c:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010350f:	83 c0 04             	add    $0x4,%eax
c0103512:	c7 45 c0 01 00 00 00 	movl   $0x1,-0x40(%ebp)
c0103519:	89 45 bc             	mov    %eax,-0x44(%ebp)
c010351c:	8b 45 bc             	mov    -0x44(%ebp),%eax
c010351f:	8b 55 c0             	mov    -0x40(%ebp),%edx
c0103522:	0f b3 10             	btr    %edx,(%eax)
        SetPageReserved(p);
c0103525:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0103528:	83 c0 04             	add    $0x4,%eax
c010352b:	c7 45 b8 00 00 00 00 	movl   $0x0,-0x48(%ebp)
c0103532:	89 45 b4             	mov    %eax,-0x4c(%ebp)
 * Note that @nr may be almost arbitrarily large; this function is not
 * restricted to acting on a single-word quantity.
 * */
static inline void
set_bit(int nr, volatile void *addr) {
    asm volatile ("btsl %1, %0" :"=m" (*(volatile long *)addr) : "Ir" (nr));
c0103535:	8b 45 b4             	mov    -0x4c(%ebp),%eax
c0103538:	8b 55 b8             	mov    -0x48(%ebp),%edx
c010353b:	0f ab 10             	bts    %edx,(%eax)
        nr_free -= n;
c010353e:	a1 c8 1a 12 c0       	mov    0xc0121ac8,%eax
c0103543:	2b 45 08             	sub    0x8(%ebp),%eax
c0103546:	a3 c8 1a 12 c0       	mov    %eax,0xc0121ac8
        return p;
c010354b:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010354e:	eb 21                	jmp    c0103571 <default_alloc_pages+0x17b>
c0103550:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0103553:	89 45 b0             	mov    %eax,-0x50(%ebp)
 * list_next - get the next entry
 * @listelm:    the list head
 **/
static inline list_entry_t *
list_next(list_entry_t *listelm) {
    return listelm->next;
c0103556:	8b 45 b0             	mov    -0x50(%ebp),%eax
c0103559:	8b 40 04             	mov    0x4(%eax),%eax
        return NULL;
    }
    list_entry_t *le, *len;
    le = &free_list;

    while((le=list_next(le)) != &free_list) {
c010355c:	89 45 f4             	mov    %eax,-0xc(%ebp)
c010355f:	81 7d f4 c0 1a 12 c0 	cmpl   $0xc0121ac0,-0xc(%ebp)
c0103566:	0f 85 da fe ff ff    	jne    c0103446 <default_alloc_pages+0x50>
        SetPageReserved(p);
        nr_free -= n;
        return p;
      }
    }
    return NULL;
c010356c:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0103571:	c9                   	leave  
c0103572:	c3                   	ret    

c0103573 <default_free_pages>:

static void
default_free_pages(struct Page *base, size_t n) {
c0103573:	55                   	push   %ebp
c0103574:	89 e5                	mov    %esp,%ebp
c0103576:	83 ec 68             	sub    $0x68,%esp
    assert(n > 0);
c0103579:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
c010357d:	75 24                	jne    c01035a3 <default_free_pages+0x30>
c010357f:	c7 44 24 0c 70 94 10 	movl   $0xc0109470,0xc(%esp)
c0103586:	c0 
c0103587:	c7 44 24 08 76 94 10 	movl   $0xc0109476,0x8(%esp)
c010358e:	c0 
c010358f:	c7 44 24 04 78 00 00 	movl   $0x78,0x4(%esp)
c0103596:	00 
c0103597:	c7 04 24 8b 94 10 c0 	movl   $0xc010948b,(%esp)
c010359e:	e8 32 d7 ff ff       	call   c0100cd5 <__panic>
    assert(PageReserved(base));
c01035a3:	8b 45 08             	mov    0x8(%ebp),%eax
c01035a6:	83 c0 04             	add    $0x4,%eax
c01035a9:	c7 45 ec 00 00 00 00 	movl   $0x0,-0x14(%ebp)
c01035b0:	89 45 e8             	mov    %eax,-0x18(%ebp)
 * @addr:   the address to count from
 * */
static inline bool
test_bit(int nr, volatile void *addr) {
    int oldbit;
    asm volatile ("btl %2, %1; sbbl %0,%0" : "=r" (oldbit) : "m" (*(volatile long *)addr), "Ir" (nr));
c01035b3:	8b 45 e8             	mov    -0x18(%ebp),%eax
c01035b6:	8b 55 ec             	mov    -0x14(%ebp),%edx
c01035b9:	0f a3 10             	bt     %edx,(%eax)
c01035bc:	19 c0                	sbb    %eax,%eax
c01035be:	89 45 e4             	mov    %eax,-0x1c(%ebp)
    return oldbit != 0;
c01035c1:	83 7d e4 00          	cmpl   $0x0,-0x1c(%ebp)
c01035c5:	0f 95 c0             	setne  %al
c01035c8:	0f b6 c0             	movzbl %al,%eax
c01035cb:	85 c0                	test   %eax,%eax
c01035cd:	75 24                	jne    c01035f3 <default_free_pages+0x80>
c01035cf:	c7 44 24 0c b1 94 10 	movl   $0xc01094b1,0xc(%esp)
c01035d6:	c0 
c01035d7:	c7 44 24 08 76 94 10 	movl   $0xc0109476,0x8(%esp)
c01035de:	c0 
c01035df:	c7 44 24 04 79 00 00 	movl   $0x79,0x4(%esp)
c01035e6:	00 
c01035e7:	c7 04 24 8b 94 10 c0 	movl   $0xc010948b,(%esp)
c01035ee:	e8 e2 d6 ff ff       	call   c0100cd5 <__panic>

    list_entry_t *le = &free_list;
c01035f3:	c7 45 f4 c0 1a 12 c0 	movl   $0xc0121ac0,-0xc(%ebp)
    struct Page * p;
    while((le=list_next(le)) != &free_list) {
c01035fa:	eb 13                	jmp    c010360f <default_free_pages+0x9c>
      p = le2page(le, page_link);
c01035fc:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01035ff:	83 e8 0c             	sub    $0xc,%eax
c0103602:	89 45 f0             	mov    %eax,-0x10(%ebp)
      if(p>base){
c0103605:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0103608:	3b 45 08             	cmp    0x8(%ebp),%eax
c010360b:	76 02                	jbe    c010360f <default_free_pages+0x9c>
        break;
c010360d:	eb 18                	jmp    c0103627 <default_free_pages+0xb4>
c010360f:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0103612:	89 45 e0             	mov    %eax,-0x20(%ebp)
c0103615:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0103618:	8b 40 04             	mov    0x4(%eax),%eax
    assert(n > 0);
    assert(PageReserved(base));

    list_entry_t *le = &free_list;
    struct Page * p;
    while((le=list_next(le)) != &free_list) {
c010361b:	89 45 f4             	mov    %eax,-0xc(%ebp)
c010361e:	81 7d f4 c0 1a 12 c0 	cmpl   $0xc0121ac0,-0xc(%ebp)
c0103625:	75 d5                	jne    c01035fc <default_free_pages+0x89>
      if(p>base){
        break;
      }
    }
    //list_add_before(le, base->page_link);
    for(p=base;p<base+n;p++){
c0103627:	8b 45 08             	mov    0x8(%ebp),%eax
c010362a:	89 45 f0             	mov    %eax,-0x10(%ebp)
c010362d:	eb 4b                	jmp    c010367a <default_free_pages+0x107>
      list_add_before(le, &(p->page_link));
c010362f:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0103632:	8d 50 0c             	lea    0xc(%eax),%edx
c0103635:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0103638:	89 45 dc             	mov    %eax,-0x24(%ebp)
c010363b:	89 55 d8             	mov    %edx,-0x28(%ebp)
 * Insert the new element @elm *before* the element @listelm which
 * is already in the list.
 * */
static inline void
list_add_before(list_entry_t *listelm, list_entry_t *elm) {
    __list_add(elm, listelm->prev, listelm);
c010363e:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0103641:	8b 00                	mov    (%eax),%eax
c0103643:	8b 55 d8             	mov    -0x28(%ebp),%edx
c0103646:	89 55 d4             	mov    %edx,-0x2c(%ebp)
c0103649:	89 45 d0             	mov    %eax,-0x30(%ebp)
c010364c:	8b 45 dc             	mov    -0x24(%ebp),%eax
c010364f:	89 45 cc             	mov    %eax,-0x34(%ebp)
 * This is only for internal list manipulation where we know
 * the prev/next entries already!
 * */
static inline void
__list_add(list_entry_t *elm, list_entry_t *prev, list_entry_t *next) {
    prev->next = next->prev = elm;
c0103652:	8b 45 cc             	mov    -0x34(%ebp),%eax
c0103655:	8b 55 d4             	mov    -0x2c(%ebp),%edx
c0103658:	89 10                	mov    %edx,(%eax)
c010365a:	8b 45 cc             	mov    -0x34(%ebp),%eax
c010365d:	8b 10                	mov    (%eax),%edx
c010365f:	8b 45 d0             	mov    -0x30(%ebp),%eax
c0103662:	89 50 04             	mov    %edx,0x4(%eax)
    elm->next = next;
c0103665:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c0103668:	8b 55 cc             	mov    -0x34(%ebp),%edx
c010366b:	89 50 04             	mov    %edx,0x4(%eax)
    elm->prev = prev;
c010366e:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c0103671:	8b 55 d0             	mov    -0x30(%ebp),%edx
c0103674:	89 10                	mov    %edx,(%eax)
      if(p>base){
        break;
      }
    }
    //list_add_before(le, base->page_link);
    for(p=base;p<base+n;p++){
c0103676:	83 45 f0 20          	addl   $0x20,-0x10(%ebp)
c010367a:	8b 45 0c             	mov    0xc(%ebp),%eax
c010367d:	c1 e0 05             	shl    $0x5,%eax
c0103680:	89 c2                	mov    %eax,%edx
c0103682:	8b 45 08             	mov    0x8(%ebp),%eax
c0103685:	01 d0                	add    %edx,%eax
c0103687:	3b 45 f0             	cmp    -0x10(%ebp),%eax
c010368a:	77 a3                	ja     c010362f <default_free_pages+0xbc>
      list_add_before(le, &(p->page_link));
    }
    base->flags = 0;
c010368c:	8b 45 08             	mov    0x8(%ebp),%eax
c010368f:	c7 40 04 00 00 00 00 	movl   $0x0,0x4(%eax)
    set_page_ref(base, 0);
c0103696:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c010369d:	00 
c010369e:	8b 45 08             	mov    0x8(%ebp),%eax
c01036a1:	89 04 24             	mov    %eax,(%esp)
c01036a4:	e8 cb fb ff ff       	call   c0103274 <set_page_ref>
    ClearPageProperty(base);
c01036a9:	8b 45 08             	mov    0x8(%ebp),%eax
c01036ac:	83 c0 04             	add    $0x4,%eax
c01036af:	c7 45 c8 01 00 00 00 	movl   $0x1,-0x38(%ebp)
c01036b6:	89 45 c4             	mov    %eax,-0x3c(%ebp)
 * @nr:     the bit to clear
 * @addr:   the address to start counting from
 * */
static inline void
clear_bit(int nr, volatile void *addr) {
    asm volatile ("btrl %1, %0" :"=m" (*(volatile long *)addr) : "Ir" (nr));
c01036b9:	8b 45 c4             	mov    -0x3c(%ebp),%eax
c01036bc:	8b 55 c8             	mov    -0x38(%ebp),%edx
c01036bf:	0f b3 10             	btr    %edx,(%eax)
    SetPageProperty(base);
c01036c2:	8b 45 08             	mov    0x8(%ebp),%eax
c01036c5:	83 c0 04             	add    $0x4,%eax
c01036c8:	c7 45 c0 01 00 00 00 	movl   $0x1,-0x40(%ebp)
c01036cf:	89 45 bc             	mov    %eax,-0x44(%ebp)
 * Note that @nr may be almost arbitrarily large; this function is not
 * restricted to acting on a single-word quantity.
 * */
static inline void
set_bit(int nr, volatile void *addr) {
    asm volatile ("btsl %1, %0" :"=m" (*(volatile long *)addr) : "Ir" (nr));
c01036d2:	8b 45 bc             	mov    -0x44(%ebp),%eax
c01036d5:	8b 55 c0             	mov    -0x40(%ebp),%edx
c01036d8:	0f ab 10             	bts    %edx,(%eax)
    base->property = n;
c01036db:	8b 45 08             	mov    0x8(%ebp),%eax
c01036de:	8b 55 0c             	mov    0xc(%ebp),%edx
c01036e1:	89 50 08             	mov    %edx,0x8(%eax)
    
    p = le2page(le,page_link) ;
c01036e4:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01036e7:	83 e8 0c             	sub    $0xc,%eax
c01036ea:	89 45 f0             	mov    %eax,-0x10(%ebp)
    if( base+n == p ){
c01036ed:	8b 45 0c             	mov    0xc(%ebp),%eax
c01036f0:	c1 e0 05             	shl    $0x5,%eax
c01036f3:	89 c2                	mov    %eax,%edx
c01036f5:	8b 45 08             	mov    0x8(%ebp),%eax
c01036f8:	01 d0                	add    %edx,%eax
c01036fa:	3b 45 f0             	cmp    -0x10(%ebp),%eax
c01036fd:	75 1e                	jne    c010371d <default_free_pages+0x1aa>
      base->property += p->property;
c01036ff:	8b 45 08             	mov    0x8(%ebp),%eax
c0103702:	8b 50 08             	mov    0x8(%eax),%edx
c0103705:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0103708:	8b 40 08             	mov    0x8(%eax),%eax
c010370b:	01 c2                	add    %eax,%edx
c010370d:	8b 45 08             	mov    0x8(%ebp),%eax
c0103710:	89 50 08             	mov    %edx,0x8(%eax)
      p->property = 0;
c0103713:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0103716:	c7 40 08 00 00 00 00 	movl   $0x0,0x8(%eax)
    }
    le = list_prev(&(base->page_link));
c010371d:	8b 45 08             	mov    0x8(%ebp),%eax
c0103720:	83 c0 0c             	add    $0xc,%eax
c0103723:	89 45 b8             	mov    %eax,-0x48(%ebp)
 * list_prev - get the previous entry
 * @listelm:    the list head
 **/
static inline list_entry_t *
list_prev(list_entry_t *listelm) {
    return listelm->prev;
c0103726:	8b 45 b8             	mov    -0x48(%ebp),%eax
c0103729:	8b 00                	mov    (%eax),%eax
c010372b:	89 45 f4             	mov    %eax,-0xc(%ebp)
    p = le2page(le, page_link);
c010372e:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0103731:	83 e8 0c             	sub    $0xc,%eax
c0103734:	89 45 f0             	mov    %eax,-0x10(%ebp)
    if(le!=&free_list && p==base-1){
c0103737:	81 7d f4 c0 1a 12 c0 	cmpl   $0xc0121ac0,-0xc(%ebp)
c010373e:	74 57                	je     c0103797 <default_free_pages+0x224>
c0103740:	8b 45 08             	mov    0x8(%ebp),%eax
c0103743:	83 e8 20             	sub    $0x20,%eax
c0103746:	3b 45 f0             	cmp    -0x10(%ebp),%eax
c0103749:	75 4c                	jne    c0103797 <default_free_pages+0x224>
      while(le!=&free_list){
c010374b:	eb 41                	jmp    c010378e <default_free_pages+0x21b>
        if(p->property){
c010374d:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0103750:	8b 40 08             	mov    0x8(%eax),%eax
c0103753:	85 c0                	test   %eax,%eax
c0103755:	74 20                	je     c0103777 <default_free_pages+0x204>
          p->property += base->property;
c0103757:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010375a:	8b 50 08             	mov    0x8(%eax),%edx
c010375d:	8b 45 08             	mov    0x8(%ebp),%eax
c0103760:	8b 40 08             	mov    0x8(%eax),%eax
c0103763:	01 c2                	add    %eax,%edx
c0103765:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0103768:	89 50 08             	mov    %edx,0x8(%eax)
          base->property = 0;
c010376b:	8b 45 08             	mov    0x8(%ebp),%eax
c010376e:	c7 40 08 00 00 00 00 	movl   $0x0,0x8(%eax)
          break;
c0103775:	eb 20                	jmp    c0103797 <default_free_pages+0x224>
c0103777:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010377a:	89 45 b4             	mov    %eax,-0x4c(%ebp)
c010377d:	8b 45 b4             	mov    -0x4c(%ebp),%eax
c0103780:	8b 00                	mov    (%eax),%eax
        }
        le = list_prev(le);
c0103782:	89 45 f4             	mov    %eax,-0xc(%ebp)
        p = le2page(le,page_link);
c0103785:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0103788:	83 e8 0c             	sub    $0xc,%eax
c010378b:	89 45 f0             	mov    %eax,-0x10(%ebp)
      p->property = 0;
    }
    le = list_prev(&(base->page_link));
    p = le2page(le, page_link);
    if(le!=&free_list && p==base-1){
      while(le!=&free_list){
c010378e:	81 7d f4 c0 1a 12 c0 	cmpl   $0xc0121ac0,-0xc(%ebp)
c0103795:	75 b6                	jne    c010374d <default_free_pages+0x1da>
        le = list_prev(le);
        p = le2page(le,page_link);
      }
    }

    nr_free += n;
c0103797:	8b 15 c8 1a 12 c0    	mov    0xc0121ac8,%edx
c010379d:	8b 45 0c             	mov    0xc(%ebp),%eax
c01037a0:	01 d0                	add    %edx,%eax
c01037a2:	a3 c8 1a 12 c0       	mov    %eax,0xc0121ac8
    return ;
c01037a7:	90                   	nop
}
c01037a8:	c9                   	leave  
c01037a9:	c3                   	ret    

c01037aa <default_nr_free_pages>:

static size_t
default_nr_free_pages(void) {
c01037aa:	55                   	push   %ebp
c01037ab:	89 e5                	mov    %esp,%ebp
    return nr_free;
c01037ad:	a1 c8 1a 12 c0       	mov    0xc0121ac8,%eax
}
c01037b2:	5d                   	pop    %ebp
c01037b3:	c3                   	ret    

c01037b4 <basic_check>:

static void
basic_check(void) {
c01037b4:	55                   	push   %ebp
c01037b5:	89 e5                	mov    %esp,%ebp
c01037b7:	83 ec 48             	sub    $0x48,%esp
    struct Page *p0, *p1, *p2;
    p0 = p1 = p2 = NULL;
c01037ba:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
c01037c1:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01037c4:	89 45 f0             	mov    %eax,-0x10(%ebp)
c01037c7:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01037ca:	89 45 ec             	mov    %eax,-0x14(%ebp)
    assert((p0 = alloc_page()) != NULL);
c01037cd:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c01037d4:	e8 bf 0e 00 00       	call   c0104698 <alloc_pages>
c01037d9:	89 45 ec             	mov    %eax,-0x14(%ebp)
c01037dc:	83 7d ec 00          	cmpl   $0x0,-0x14(%ebp)
c01037e0:	75 24                	jne    c0103806 <basic_check+0x52>
c01037e2:	c7 44 24 0c c4 94 10 	movl   $0xc01094c4,0xc(%esp)
c01037e9:	c0 
c01037ea:	c7 44 24 08 76 94 10 	movl   $0xc0109476,0x8(%esp)
c01037f1:	c0 
c01037f2:	c7 44 24 04 ad 00 00 	movl   $0xad,0x4(%esp)
c01037f9:	00 
c01037fa:	c7 04 24 8b 94 10 c0 	movl   $0xc010948b,(%esp)
c0103801:	e8 cf d4 ff ff       	call   c0100cd5 <__panic>
    assert((p1 = alloc_page()) != NULL);
c0103806:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c010380d:	e8 86 0e 00 00       	call   c0104698 <alloc_pages>
c0103812:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0103815:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c0103819:	75 24                	jne    c010383f <basic_check+0x8b>
c010381b:	c7 44 24 0c e0 94 10 	movl   $0xc01094e0,0xc(%esp)
c0103822:	c0 
c0103823:	c7 44 24 08 76 94 10 	movl   $0xc0109476,0x8(%esp)
c010382a:	c0 
c010382b:	c7 44 24 04 ae 00 00 	movl   $0xae,0x4(%esp)
c0103832:	00 
c0103833:	c7 04 24 8b 94 10 c0 	movl   $0xc010948b,(%esp)
c010383a:	e8 96 d4 ff ff       	call   c0100cd5 <__panic>
    assert((p2 = alloc_page()) != NULL);
c010383f:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0103846:	e8 4d 0e 00 00       	call   c0104698 <alloc_pages>
c010384b:	89 45 f4             	mov    %eax,-0xc(%ebp)
c010384e:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0103852:	75 24                	jne    c0103878 <basic_check+0xc4>
c0103854:	c7 44 24 0c fc 94 10 	movl   $0xc01094fc,0xc(%esp)
c010385b:	c0 
c010385c:	c7 44 24 08 76 94 10 	movl   $0xc0109476,0x8(%esp)
c0103863:	c0 
c0103864:	c7 44 24 04 af 00 00 	movl   $0xaf,0x4(%esp)
c010386b:	00 
c010386c:	c7 04 24 8b 94 10 c0 	movl   $0xc010948b,(%esp)
c0103873:	e8 5d d4 ff ff       	call   c0100cd5 <__panic>

    assert(p0 != p1 && p0 != p2 && p1 != p2);
c0103878:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010387b:	3b 45 f0             	cmp    -0x10(%ebp),%eax
c010387e:	74 10                	je     c0103890 <basic_check+0xdc>
c0103880:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0103883:	3b 45 f4             	cmp    -0xc(%ebp),%eax
c0103886:	74 08                	je     c0103890 <basic_check+0xdc>
c0103888:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010388b:	3b 45 f4             	cmp    -0xc(%ebp),%eax
c010388e:	75 24                	jne    c01038b4 <basic_check+0x100>
c0103890:	c7 44 24 0c 18 95 10 	movl   $0xc0109518,0xc(%esp)
c0103897:	c0 
c0103898:	c7 44 24 08 76 94 10 	movl   $0xc0109476,0x8(%esp)
c010389f:	c0 
c01038a0:	c7 44 24 04 b1 00 00 	movl   $0xb1,0x4(%esp)
c01038a7:	00 
c01038a8:	c7 04 24 8b 94 10 c0 	movl   $0xc010948b,(%esp)
c01038af:	e8 21 d4 ff ff       	call   c0100cd5 <__panic>
    assert(page_ref(p0) == 0 && page_ref(p1) == 0 && page_ref(p2) == 0);
c01038b4:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01038b7:	89 04 24             	mov    %eax,(%esp)
c01038ba:	e8 ab f9 ff ff       	call   c010326a <page_ref>
c01038bf:	85 c0                	test   %eax,%eax
c01038c1:	75 1e                	jne    c01038e1 <basic_check+0x12d>
c01038c3:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01038c6:	89 04 24             	mov    %eax,(%esp)
c01038c9:	e8 9c f9 ff ff       	call   c010326a <page_ref>
c01038ce:	85 c0                	test   %eax,%eax
c01038d0:	75 0f                	jne    c01038e1 <basic_check+0x12d>
c01038d2:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01038d5:	89 04 24             	mov    %eax,(%esp)
c01038d8:	e8 8d f9 ff ff       	call   c010326a <page_ref>
c01038dd:	85 c0                	test   %eax,%eax
c01038df:	74 24                	je     c0103905 <basic_check+0x151>
c01038e1:	c7 44 24 0c 3c 95 10 	movl   $0xc010953c,0xc(%esp)
c01038e8:	c0 
c01038e9:	c7 44 24 08 76 94 10 	movl   $0xc0109476,0x8(%esp)
c01038f0:	c0 
c01038f1:	c7 44 24 04 b2 00 00 	movl   $0xb2,0x4(%esp)
c01038f8:	00 
c01038f9:	c7 04 24 8b 94 10 c0 	movl   $0xc010948b,(%esp)
c0103900:	e8 d0 d3 ff ff       	call   c0100cd5 <__panic>

    assert(page2pa(p0) < npage * PGSIZE);
c0103905:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0103908:	89 04 24             	mov    %eax,(%esp)
c010390b:	e8 44 f9 ff ff       	call   c0103254 <page2pa>
c0103910:	8b 15 20 1a 12 c0    	mov    0xc0121a20,%edx
c0103916:	c1 e2 0c             	shl    $0xc,%edx
c0103919:	39 d0                	cmp    %edx,%eax
c010391b:	72 24                	jb     c0103941 <basic_check+0x18d>
c010391d:	c7 44 24 0c 78 95 10 	movl   $0xc0109578,0xc(%esp)
c0103924:	c0 
c0103925:	c7 44 24 08 76 94 10 	movl   $0xc0109476,0x8(%esp)
c010392c:	c0 
c010392d:	c7 44 24 04 b4 00 00 	movl   $0xb4,0x4(%esp)
c0103934:	00 
c0103935:	c7 04 24 8b 94 10 c0 	movl   $0xc010948b,(%esp)
c010393c:	e8 94 d3 ff ff       	call   c0100cd5 <__panic>
    assert(page2pa(p1) < npage * PGSIZE);
c0103941:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0103944:	89 04 24             	mov    %eax,(%esp)
c0103947:	e8 08 f9 ff ff       	call   c0103254 <page2pa>
c010394c:	8b 15 20 1a 12 c0    	mov    0xc0121a20,%edx
c0103952:	c1 e2 0c             	shl    $0xc,%edx
c0103955:	39 d0                	cmp    %edx,%eax
c0103957:	72 24                	jb     c010397d <basic_check+0x1c9>
c0103959:	c7 44 24 0c 95 95 10 	movl   $0xc0109595,0xc(%esp)
c0103960:	c0 
c0103961:	c7 44 24 08 76 94 10 	movl   $0xc0109476,0x8(%esp)
c0103968:	c0 
c0103969:	c7 44 24 04 b5 00 00 	movl   $0xb5,0x4(%esp)
c0103970:	00 
c0103971:	c7 04 24 8b 94 10 c0 	movl   $0xc010948b,(%esp)
c0103978:	e8 58 d3 ff ff       	call   c0100cd5 <__panic>
    assert(page2pa(p2) < npage * PGSIZE);
c010397d:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0103980:	89 04 24             	mov    %eax,(%esp)
c0103983:	e8 cc f8 ff ff       	call   c0103254 <page2pa>
c0103988:	8b 15 20 1a 12 c0    	mov    0xc0121a20,%edx
c010398e:	c1 e2 0c             	shl    $0xc,%edx
c0103991:	39 d0                	cmp    %edx,%eax
c0103993:	72 24                	jb     c01039b9 <basic_check+0x205>
c0103995:	c7 44 24 0c b2 95 10 	movl   $0xc01095b2,0xc(%esp)
c010399c:	c0 
c010399d:	c7 44 24 08 76 94 10 	movl   $0xc0109476,0x8(%esp)
c01039a4:	c0 
c01039a5:	c7 44 24 04 b6 00 00 	movl   $0xb6,0x4(%esp)
c01039ac:	00 
c01039ad:	c7 04 24 8b 94 10 c0 	movl   $0xc010948b,(%esp)
c01039b4:	e8 1c d3 ff ff       	call   c0100cd5 <__panic>

    list_entry_t free_list_store = free_list;
c01039b9:	a1 c0 1a 12 c0       	mov    0xc0121ac0,%eax
c01039be:	8b 15 c4 1a 12 c0    	mov    0xc0121ac4,%edx
c01039c4:	89 45 d0             	mov    %eax,-0x30(%ebp)
c01039c7:	89 55 d4             	mov    %edx,-0x2c(%ebp)
c01039ca:	c7 45 e0 c0 1a 12 c0 	movl   $0xc0121ac0,-0x20(%ebp)
 * list_init - initialize a new entry
 * @elm:        new entry to be initialized
 * */
static inline void
list_init(list_entry_t *elm) {
    elm->prev = elm->next = elm;
c01039d1:	8b 45 e0             	mov    -0x20(%ebp),%eax
c01039d4:	8b 55 e0             	mov    -0x20(%ebp),%edx
c01039d7:	89 50 04             	mov    %edx,0x4(%eax)
c01039da:	8b 45 e0             	mov    -0x20(%ebp),%eax
c01039dd:	8b 50 04             	mov    0x4(%eax),%edx
c01039e0:	8b 45 e0             	mov    -0x20(%ebp),%eax
c01039e3:	89 10                	mov    %edx,(%eax)
c01039e5:	c7 45 dc c0 1a 12 c0 	movl   $0xc0121ac0,-0x24(%ebp)
 * list_empty - tests whether a list is empty
 * @list:       the list to test.
 * */
static inline bool
list_empty(list_entry_t *list) {
    return list->next == list;
c01039ec:	8b 45 dc             	mov    -0x24(%ebp),%eax
c01039ef:	8b 40 04             	mov    0x4(%eax),%eax
c01039f2:	39 45 dc             	cmp    %eax,-0x24(%ebp)
c01039f5:	0f 94 c0             	sete   %al
c01039f8:	0f b6 c0             	movzbl %al,%eax
    list_init(&free_list);
    assert(list_empty(&free_list));
c01039fb:	85 c0                	test   %eax,%eax
c01039fd:	75 24                	jne    c0103a23 <basic_check+0x26f>
c01039ff:	c7 44 24 0c cf 95 10 	movl   $0xc01095cf,0xc(%esp)
c0103a06:	c0 
c0103a07:	c7 44 24 08 76 94 10 	movl   $0xc0109476,0x8(%esp)
c0103a0e:	c0 
c0103a0f:	c7 44 24 04 ba 00 00 	movl   $0xba,0x4(%esp)
c0103a16:	00 
c0103a17:	c7 04 24 8b 94 10 c0 	movl   $0xc010948b,(%esp)
c0103a1e:	e8 b2 d2 ff ff       	call   c0100cd5 <__panic>

    unsigned int nr_free_store = nr_free;
c0103a23:	a1 c8 1a 12 c0       	mov    0xc0121ac8,%eax
c0103a28:	89 45 e8             	mov    %eax,-0x18(%ebp)
    nr_free = 0;
c0103a2b:	c7 05 c8 1a 12 c0 00 	movl   $0x0,0xc0121ac8
c0103a32:	00 00 00 

    assert(alloc_page() == NULL);
c0103a35:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0103a3c:	e8 57 0c 00 00       	call   c0104698 <alloc_pages>
c0103a41:	85 c0                	test   %eax,%eax
c0103a43:	74 24                	je     c0103a69 <basic_check+0x2b5>
c0103a45:	c7 44 24 0c e6 95 10 	movl   $0xc01095e6,0xc(%esp)
c0103a4c:	c0 
c0103a4d:	c7 44 24 08 76 94 10 	movl   $0xc0109476,0x8(%esp)
c0103a54:	c0 
c0103a55:	c7 44 24 04 bf 00 00 	movl   $0xbf,0x4(%esp)
c0103a5c:	00 
c0103a5d:	c7 04 24 8b 94 10 c0 	movl   $0xc010948b,(%esp)
c0103a64:	e8 6c d2 ff ff       	call   c0100cd5 <__panic>

    free_page(p0);
c0103a69:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c0103a70:	00 
c0103a71:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0103a74:	89 04 24             	mov    %eax,(%esp)
c0103a77:	e8 87 0c 00 00       	call   c0104703 <free_pages>
    free_page(p1);
c0103a7c:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c0103a83:	00 
c0103a84:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0103a87:	89 04 24             	mov    %eax,(%esp)
c0103a8a:	e8 74 0c 00 00       	call   c0104703 <free_pages>
    free_page(p2);
c0103a8f:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c0103a96:	00 
c0103a97:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0103a9a:	89 04 24             	mov    %eax,(%esp)
c0103a9d:	e8 61 0c 00 00       	call   c0104703 <free_pages>
    assert(nr_free == 3);
c0103aa2:	a1 c8 1a 12 c0       	mov    0xc0121ac8,%eax
c0103aa7:	83 f8 03             	cmp    $0x3,%eax
c0103aaa:	74 24                	je     c0103ad0 <basic_check+0x31c>
c0103aac:	c7 44 24 0c fb 95 10 	movl   $0xc01095fb,0xc(%esp)
c0103ab3:	c0 
c0103ab4:	c7 44 24 08 76 94 10 	movl   $0xc0109476,0x8(%esp)
c0103abb:	c0 
c0103abc:	c7 44 24 04 c4 00 00 	movl   $0xc4,0x4(%esp)
c0103ac3:	00 
c0103ac4:	c7 04 24 8b 94 10 c0 	movl   $0xc010948b,(%esp)
c0103acb:	e8 05 d2 ff ff       	call   c0100cd5 <__panic>

    assert((p0 = alloc_page()) != NULL);
c0103ad0:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0103ad7:	e8 bc 0b 00 00       	call   c0104698 <alloc_pages>
c0103adc:	89 45 ec             	mov    %eax,-0x14(%ebp)
c0103adf:	83 7d ec 00          	cmpl   $0x0,-0x14(%ebp)
c0103ae3:	75 24                	jne    c0103b09 <basic_check+0x355>
c0103ae5:	c7 44 24 0c c4 94 10 	movl   $0xc01094c4,0xc(%esp)
c0103aec:	c0 
c0103aed:	c7 44 24 08 76 94 10 	movl   $0xc0109476,0x8(%esp)
c0103af4:	c0 
c0103af5:	c7 44 24 04 c6 00 00 	movl   $0xc6,0x4(%esp)
c0103afc:	00 
c0103afd:	c7 04 24 8b 94 10 c0 	movl   $0xc010948b,(%esp)
c0103b04:	e8 cc d1 ff ff       	call   c0100cd5 <__panic>
    assert((p1 = alloc_page()) != NULL);
c0103b09:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0103b10:	e8 83 0b 00 00       	call   c0104698 <alloc_pages>
c0103b15:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0103b18:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c0103b1c:	75 24                	jne    c0103b42 <basic_check+0x38e>
c0103b1e:	c7 44 24 0c e0 94 10 	movl   $0xc01094e0,0xc(%esp)
c0103b25:	c0 
c0103b26:	c7 44 24 08 76 94 10 	movl   $0xc0109476,0x8(%esp)
c0103b2d:	c0 
c0103b2e:	c7 44 24 04 c7 00 00 	movl   $0xc7,0x4(%esp)
c0103b35:	00 
c0103b36:	c7 04 24 8b 94 10 c0 	movl   $0xc010948b,(%esp)
c0103b3d:	e8 93 d1 ff ff       	call   c0100cd5 <__panic>
    assert((p2 = alloc_page()) != NULL);
c0103b42:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0103b49:	e8 4a 0b 00 00       	call   c0104698 <alloc_pages>
c0103b4e:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0103b51:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0103b55:	75 24                	jne    c0103b7b <basic_check+0x3c7>
c0103b57:	c7 44 24 0c fc 94 10 	movl   $0xc01094fc,0xc(%esp)
c0103b5e:	c0 
c0103b5f:	c7 44 24 08 76 94 10 	movl   $0xc0109476,0x8(%esp)
c0103b66:	c0 
c0103b67:	c7 44 24 04 c8 00 00 	movl   $0xc8,0x4(%esp)
c0103b6e:	00 
c0103b6f:	c7 04 24 8b 94 10 c0 	movl   $0xc010948b,(%esp)
c0103b76:	e8 5a d1 ff ff       	call   c0100cd5 <__panic>

    assert(alloc_page() == NULL);
c0103b7b:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0103b82:	e8 11 0b 00 00       	call   c0104698 <alloc_pages>
c0103b87:	85 c0                	test   %eax,%eax
c0103b89:	74 24                	je     c0103baf <basic_check+0x3fb>
c0103b8b:	c7 44 24 0c e6 95 10 	movl   $0xc01095e6,0xc(%esp)
c0103b92:	c0 
c0103b93:	c7 44 24 08 76 94 10 	movl   $0xc0109476,0x8(%esp)
c0103b9a:	c0 
c0103b9b:	c7 44 24 04 ca 00 00 	movl   $0xca,0x4(%esp)
c0103ba2:	00 
c0103ba3:	c7 04 24 8b 94 10 c0 	movl   $0xc010948b,(%esp)
c0103baa:	e8 26 d1 ff ff       	call   c0100cd5 <__panic>

    free_page(p0);
c0103baf:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c0103bb6:	00 
c0103bb7:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0103bba:	89 04 24             	mov    %eax,(%esp)
c0103bbd:	e8 41 0b 00 00       	call   c0104703 <free_pages>
c0103bc2:	c7 45 d8 c0 1a 12 c0 	movl   $0xc0121ac0,-0x28(%ebp)
c0103bc9:	8b 45 d8             	mov    -0x28(%ebp),%eax
c0103bcc:	8b 40 04             	mov    0x4(%eax),%eax
c0103bcf:	39 45 d8             	cmp    %eax,-0x28(%ebp)
c0103bd2:	0f 94 c0             	sete   %al
c0103bd5:	0f b6 c0             	movzbl %al,%eax
    assert(!list_empty(&free_list));
c0103bd8:	85 c0                	test   %eax,%eax
c0103bda:	74 24                	je     c0103c00 <basic_check+0x44c>
c0103bdc:	c7 44 24 0c 08 96 10 	movl   $0xc0109608,0xc(%esp)
c0103be3:	c0 
c0103be4:	c7 44 24 08 76 94 10 	movl   $0xc0109476,0x8(%esp)
c0103beb:	c0 
c0103bec:	c7 44 24 04 cd 00 00 	movl   $0xcd,0x4(%esp)
c0103bf3:	00 
c0103bf4:	c7 04 24 8b 94 10 c0 	movl   $0xc010948b,(%esp)
c0103bfb:	e8 d5 d0 ff ff       	call   c0100cd5 <__panic>

    struct Page *p;
    assert((p = alloc_page()) == p0);
c0103c00:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0103c07:	e8 8c 0a 00 00       	call   c0104698 <alloc_pages>
c0103c0c:	89 45 e4             	mov    %eax,-0x1c(%ebp)
c0103c0f:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0103c12:	3b 45 ec             	cmp    -0x14(%ebp),%eax
c0103c15:	74 24                	je     c0103c3b <basic_check+0x487>
c0103c17:	c7 44 24 0c 20 96 10 	movl   $0xc0109620,0xc(%esp)
c0103c1e:	c0 
c0103c1f:	c7 44 24 08 76 94 10 	movl   $0xc0109476,0x8(%esp)
c0103c26:	c0 
c0103c27:	c7 44 24 04 d0 00 00 	movl   $0xd0,0x4(%esp)
c0103c2e:	00 
c0103c2f:	c7 04 24 8b 94 10 c0 	movl   $0xc010948b,(%esp)
c0103c36:	e8 9a d0 ff ff       	call   c0100cd5 <__panic>
    assert(alloc_page() == NULL);
c0103c3b:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0103c42:	e8 51 0a 00 00       	call   c0104698 <alloc_pages>
c0103c47:	85 c0                	test   %eax,%eax
c0103c49:	74 24                	je     c0103c6f <basic_check+0x4bb>
c0103c4b:	c7 44 24 0c e6 95 10 	movl   $0xc01095e6,0xc(%esp)
c0103c52:	c0 
c0103c53:	c7 44 24 08 76 94 10 	movl   $0xc0109476,0x8(%esp)
c0103c5a:	c0 
c0103c5b:	c7 44 24 04 d1 00 00 	movl   $0xd1,0x4(%esp)
c0103c62:	00 
c0103c63:	c7 04 24 8b 94 10 c0 	movl   $0xc010948b,(%esp)
c0103c6a:	e8 66 d0 ff ff       	call   c0100cd5 <__panic>

    assert(nr_free == 0);
c0103c6f:	a1 c8 1a 12 c0       	mov    0xc0121ac8,%eax
c0103c74:	85 c0                	test   %eax,%eax
c0103c76:	74 24                	je     c0103c9c <basic_check+0x4e8>
c0103c78:	c7 44 24 0c 39 96 10 	movl   $0xc0109639,0xc(%esp)
c0103c7f:	c0 
c0103c80:	c7 44 24 08 76 94 10 	movl   $0xc0109476,0x8(%esp)
c0103c87:	c0 
c0103c88:	c7 44 24 04 d3 00 00 	movl   $0xd3,0x4(%esp)
c0103c8f:	00 
c0103c90:	c7 04 24 8b 94 10 c0 	movl   $0xc010948b,(%esp)
c0103c97:	e8 39 d0 ff ff       	call   c0100cd5 <__panic>
    free_list = free_list_store;
c0103c9c:	8b 45 d0             	mov    -0x30(%ebp),%eax
c0103c9f:	8b 55 d4             	mov    -0x2c(%ebp),%edx
c0103ca2:	a3 c0 1a 12 c0       	mov    %eax,0xc0121ac0
c0103ca7:	89 15 c4 1a 12 c0    	mov    %edx,0xc0121ac4
    nr_free = nr_free_store;
c0103cad:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0103cb0:	a3 c8 1a 12 c0       	mov    %eax,0xc0121ac8

    free_page(p);
c0103cb5:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c0103cbc:	00 
c0103cbd:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0103cc0:	89 04 24             	mov    %eax,(%esp)
c0103cc3:	e8 3b 0a 00 00       	call   c0104703 <free_pages>
    free_page(p1);
c0103cc8:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c0103ccf:	00 
c0103cd0:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0103cd3:	89 04 24             	mov    %eax,(%esp)
c0103cd6:	e8 28 0a 00 00       	call   c0104703 <free_pages>
    free_page(p2);
c0103cdb:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c0103ce2:	00 
c0103ce3:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0103ce6:	89 04 24             	mov    %eax,(%esp)
c0103ce9:	e8 15 0a 00 00       	call   c0104703 <free_pages>
}
c0103cee:	c9                   	leave  
c0103cef:	c3                   	ret    

c0103cf0 <default_check>:

// LAB2: below code is used to check the first fit allocation algorithm (your EXERCISE 1) 
// NOTICE: You SHOULD NOT CHANGE basic_check, default_check functions!
static void
default_check(void) {
c0103cf0:	55                   	push   %ebp
c0103cf1:	89 e5                	mov    %esp,%ebp
c0103cf3:	53                   	push   %ebx
c0103cf4:	81 ec 94 00 00 00    	sub    $0x94,%esp
    int count = 0, total = 0;
c0103cfa:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
c0103d01:	c7 45 f0 00 00 00 00 	movl   $0x0,-0x10(%ebp)
    list_entry_t *le = &free_list;
c0103d08:	c7 45 ec c0 1a 12 c0 	movl   $0xc0121ac0,-0x14(%ebp)
    while ((le = list_next(le)) != &free_list) {
c0103d0f:	eb 6b                	jmp    c0103d7c <default_check+0x8c>
        struct Page *p = le2page(le, page_link);
c0103d11:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0103d14:	83 e8 0c             	sub    $0xc,%eax
c0103d17:	89 45 e8             	mov    %eax,-0x18(%ebp)
        assert(PageProperty(p));
c0103d1a:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0103d1d:	83 c0 04             	add    $0x4,%eax
c0103d20:	c7 45 d0 01 00 00 00 	movl   $0x1,-0x30(%ebp)
c0103d27:	89 45 cc             	mov    %eax,-0x34(%ebp)
 * @addr:   the address to count from
 * */
static inline bool
test_bit(int nr, volatile void *addr) {
    int oldbit;
    asm volatile ("btl %2, %1; sbbl %0,%0" : "=r" (oldbit) : "m" (*(volatile long *)addr), "Ir" (nr));
c0103d2a:	8b 45 cc             	mov    -0x34(%ebp),%eax
c0103d2d:	8b 55 d0             	mov    -0x30(%ebp),%edx
c0103d30:	0f a3 10             	bt     %edx,(%eax)
c0103d33:	19 c0                	sbb    %eax,%eax
c0103d35:	89 45 c8             	mov    %eax,-0x38(%ebp)
    return oldbit != 0;
c0103d38:	83 7d c8 00          	cmpl   $0x0,-0x38(%ebp)
c0103d3c:	0f 95 c0             	setne  %al
c0103d3f:	0f b6 c0             	movzbl %al,%eax
c0103d42:	85 c0                	test   %eax,%eax
c0103d44:	75 24                	jne    c0103d6a <default_check+0x7a>
c0103d46:	c7 44 24 0c 46 96 10 	movl   $0xc0109646,0xc(%esp)
c0103d4d:	c0 
c0103d4e:	c7 44 24 08 76 94 10 	movl   $0xc0109476,0x8(%esp)
c0103d55:	c0 
c0103d56:	c7 44 24 04 e4 00 00 	movl   $0xe4,0x4(%esp)
c0103d5d:	00 
c0103d5e:	c7 04 24 8b 94 10 c0 	movl   $0xc010948b,(%esp)
c0103d65:	e8 6b cf ff ff       	call   c0100cd5 <__panic>
        count ++, total += p->property;
c0103d6a:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
c0103d6e:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0103d71:	8b 50 08             	mov    0x8(%eax),%edx
c0103d74:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0103d77:	01 d0                	add    %edx,%eax
c0103d79:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0103d7c:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0103d7f:	89 45 c4             	mov    %eax,-0x3c(%ebp)
 * list_next - get the next entry
 * @listelm:    the list head
 **/
static inline list_entry_t *
list_next(list_entry_t *listelm) {
    return listelm->next;
c0103d82:	8b 45 c4             	mov    -0x3c(%ebp),%eax
c0103d85:	8b 40 04             	mov    0x4(%eax),%eax
// NOTICE: You SHOULD NOT CHANGE basic_check, default_check functions!
static void
default_check(void) {
    int count = 0, total = 0;
    list_entry_t *le = &free_list;
    while ((le = list_next(le)) != &free_list) {
c0103d88:	89 45 ec             	mov    %eax,-0x14(%ebp)
c0103d8b:	81 7d ec c0 1a 12 c0 	cmpl   $0xc0121ac0,-0x14(%ebp)
c0103d92:	0f 85 79 ff ff ff    	jne    c0103d11 <default_check+0x21>
        struct Page *p = le2page(le, page_link);
        assert(PageProperty(p));
        count ++, total += p->property;
    }
    assert(total == nr_free_pages());
c0103d98:	8b 5d f0             	mov    -0x10(%ebp),%ebx
c0103d9b:	e8 95 09 00 00       	call   c0104735 <nr_free_pages>
c0103da0:	39 c3                	cmp    %eax,%ebx
c0103da2:	74 24                	je     c0103dc8 <default_check+0xd8>
c0103da4:	c7 44 24 0c 56 96 10 	movl   $0xc0109656,0xc(%esp)
c0103dab:	c0 
c0103dac:	c7 44 24 08 76 94 10 	movl   $0xc0109476,0x8(%esp)
c0103db3:	c0 
c0103db4:	c7 44 24 04 e7 00 00 	movl   $0xe7,0x4(%esp)
c0103dbb:	00 
c0103dbc:	c7 04 24 8b 94 10 c0 	movl   $0xc010948b,(%esp)
c0103dc3:	e8 0d cf ff ff       	call   c0100cd5 <__panic>

    basic_check();
c0103dc8:	e8 e7 f9 ff ff       	call   c01037b4 <basic_check>

    struct Page *p0 = alloc_pages(5), *p1, *p2;
c0103dcd:	c7 04 24 05 00 00 00 	movl   $0x5,(%esp)
c0103dd4:	e8 bf 08 00 00       	call   c0104698 <alloc_pages>
c0103dd9:	89 45 e4             	mov    %eax,-0x1c(%ebp)
    assert(p0 != NULL);
c0103ddc:	83 7d e4 00          	cmpl   $0x0,-0x1c(%ebp)
c0103de0:	75 24                	jne    c0103e06 <default_check+0x116>
c0103de2:	c7 44 24 0c 6f 96 10 	movl   $0xc010966f,0xc(%esp)
c0103de9:	c0 
c0103dea:	c7 44 24 08 76 94 10 	movl   $0xc0109476,0x8(%esp)
c0103df1:	c0 
c0103df2:	c7 44 24 04 ec 00 00 	movl   $0xec,0x4(%esp)
c0103df9:	00 
c0103dfa:	c7 04 24 8b 94 10 c0 	movl   $0xc010948b,(%esp)
c0103e01:	e8 cf ce ff ff       	call   c0100cd5 <__panic>
    assert(!PageProperty(p0));
c0103e06:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0103e09:	83 c0 04             	add    $0x4,%eax
c0103e0c:	c7 45 c0 01 00 00 00 	movl   $0x1,-0x40(%ebp)
c0103e13:	89 45 bc             	mov    %eax,-0x44(%ebp)
 * @addr:   the address to count from
 * */
static inline bool
test_bit(int nr, volatile void *addr) {
    int oldbit;
    asm volatile ("btl %2, %1; sbbl %0,%0" : "=r" (oldbit) : "m" (*(volatile long *)addr), "Ir" (nr));
c0103e16:	8b 45 bc             	mov    -0x44(%ebp),%eax
c0103e19:	8b 55 c0             	mov    -0x40(%ebp),%edx
c0103e1c:	0f a3 10             	bt     %edx,(%eax)
c0103e1f:	19 c0                	sbb    %eax,%eax
c0103e21:	89 45 b8             	mov    %eax,-0x48(%ebp)
    return oldbit != 0;
c0103e24:	83 7d b8 00          	cmpl   $0x0,-0x48(%ebp)
c0103e28:	0f 95 c0             	setne  %al
c0103e2b:	0f b6 c0             	movzbl %al,%eax
c0103e2e:	85 c0                	test   %eax,%eax
c0103e30:	74 24                	je     c0103e56 <default_check+0x166>
c0103e32:	c7 44 24 0c 7a 96 10 	movl   $0xc010967a,0xc(%esp)
c0103e39:	c0 
c0103e3a:	c7 44 24 08 76 94 10 	movl   $0xc0109476,0x8(%esp)
c0103e41:	c0 
c0103e42:	c7 44 24 04 ed 00 00 	movl   $0xed,0x4(%esp)
c0103e49:	00 
c0103e4a:	c7 04 24 8b 94 10 c0 	movl   $0xc010948b,(%esp)
c0103e51:	e8 7f ce ff ff       	call   c0100cd5 <__panic>

    list_entry_t free_list_store = free_list;
c0103e56:	a1 c0 1a 12 c0       	mov    0xc0121ac0,%eax
c0103e5b:	8b 15 c4 1a 12 c0    	mov    0xc0121ac4,%edx
c0103e61:	89 45 80             	mov    %eax,-0x80(%ebp)
c0103e64:	89 55 84             	mov    %edx,-0x7c(%ebp)
c0103e67:	c7 45 b4 c0 1a 12 c0 	movl   $0xc0121ac0,-0x4c(%ebp)
 * list_init - initialize a new entry
 * @elm:        new entry to be initialized
 * */
static inline void
list_init(list_entry_t *elm) {
    elm->prev = elm->next = elm;
c0103e6e:	8b 45 b4             	mov    -0x4c(%ebp),%eax
c0103e71:	8b 55 b4             	mov    -0x4c(%ebp),%edx
c0103e74:	89 50 04             	mov    %edx,0x4(%eax)
c0103e77:	8b 45 b4             	mov    -0x4c(%ebp),%eax
c0103e7a:	8b 50 04             	mov    0x4(%eax),%edx
c0103e7d:	8b 45 b4             	mov    -0x4c(%ebp),%eax
c0103e80:	89 10                	mov    %edx,(%eax)
c0103e82:	c7 45 b0 c0 1a 12 c0 	movl   $0xc0121ac0,-0x50(%ebp)
 * list_empty - tests whether a list is empty
 * @list:       the list to test.
 * */
static inline bool
list_empty(list_entry_t *list) {
    return list->next == list;
c0103e89:	8b 45 b0             	mov    -0x50(%ebp),%eax
c0103e8c:	8b 40 04             	mov    0x4(%eax),%eax
c0103e8f:	39 45 b0             	cmp    %eax,-0x50(%ebp)
c0103e92:	0f 94 c0             	sete   %al
c0103e95:	0f b6 c0             	movzbl %al,%eax
    list_init(&free_list);
    assert(list_empty(&free_list));
c0103e98:	85 c0                	test   %eax,%eax
c0103e9a:	75 24                	jne    c0103ec0 <default_check+0x1d0>
c0103e9c:	c7 44 24 0c cf 95 10 	movl   $0xc01095cf,0xc(%esp)
c0103ea3:	c0 
c0103ea4:	c7 44 24 08 76 94 10 	movl   $0xc0109476,0x8(%esp)
c0103eab:	c0 
c0103eac:	c7 44 24 04 f1 00 00 	movl   $0xf1,0x4(%esp)
c0103eb3:	00 
c0103eb4:	c7 04 24 8b 94 10 c0 	movl   $0xc010948b,(%esp)
c0103ebb:	e8 15 ce ff ff       	call   c0100cd5 <__panic>
    assert(alloc_page() == NULL);
c0103ec0:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0103ec7:	e8 cc 07 00 00       	call   c0104698 <alloc_pages>
c0103ecc:	85 c0                	test   %eax,%eax
c0103ece:	74 24                	je     c0103ef4 <default_check+0x204>
c0103ed0:	c7 44 24 0c e6 95 10 	movl   $0xc01095e6,0xc(%esp)
c0103ed7:	c0 
c0103ed8:	c7 44 24 08 76 94 10 	movl   $0xc0109476,0x8(%esp)
c0103edf:	c0 
c0103ee0:	c7 44 24 04 f2 00 00 	movl   $0xf2,0x4(%esp)
c0103ee7:	00 
c0103ee8:	c7 04 24 8b 94 10 c0 	movl   $0xc010948b,(%esp)
c0103eef:	e8 e1 cd ff ff       	call   c0100cd5 <__panic>

    unsigned int nr_free_store = nr_free;
c0103ef4:	a1 c8 1a 12 c0       	mov    0xc0121ac8,%eax
c0103ef9:	89 45 e0             	mov    %eax,-0x20(%ebp)
    nr_free = 0;
c0103efc:	c7 05 c8 1a 12 c0 00 	movl   $0x0,0xc0121ac8
c0103f03:	00 00 00 

    free_pages(p0 + 2, 3);
c0103f06:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0103f09:	83 c0 40             	add    $0x40,%eax
c0103f0c:	c7 44 24 04 03 00 00 	movl   $0x3,0x4(%esp)
c0103f13:	00 
c0103f14:	89 04 24             	mov    %eax,(%esp)
c0103f17:	e8 e7 07 00 00       	call   c0104703 <free_pages>
    assert(alloc_pages(4) == NULL);
c0103f1c:	c7 04 24 04 00 00 00 	movl   $0x4,(%esp)
c0103f23:	e8 70 07 00 00       	call   c0104698 <alloc_pages>
c0103f28:	85 c0                	test   %eax,%eax
c0103f2a:	74 24                	je     c0103f50 <default_check+0x260>
c0103f2c:	c7 44 24 0c 8c 96 10 	movl   $0xc010968c,0xc(%esp)
c0103f33:	c0 
c0103f34:	c7 44 24 08 76 94 10 	movl   $0xc0109476,0x8(%esp)
c0103f3b:	c0 
c0103f3c:	c7 44 24 04 f8 00 00 	movl   $0xf8,0x4(%esp)
c0103f43:	00 
c0103f44:	c7 04 24 8b 94 10 c0 	movl   $0xc010948b,(%esp)
c0103f4b:	e8 85 cd ff ff       	call   c0100cd5 <__panic>
    assert(PageProperty(p0 + 2) && p0[2].property == 3);
c0103f50:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0103f53:	83 c0 40             	add    $0x40,%eax
c0103f56:	83 c0 04             	add    $0x4,%eax
c0103f59:	c7 45 ac 01 00 00 00 	movl   $0x1,-0x54(%ebp)
c0103f60:	89 45 a8             	mov    %eax,-0x58(%ebp)
 * @addr:   the address to count from
 * */
static inline bool
test_bit(int nr, volatile void *addr) {
    int oldbit;
    asm volatile ("btl %2, %1; sbbl %0,%0" : "=r" (oldbit) : "m" (*(volatile long *)addr), "Ir" (nr));
c0103f63:	8b 45 a8             	mov    -0x58(%ebp),%eax
c0103f66:	8b 55 ac             	mov    -0x54(%ebp),%edx
c0103f69:	0f a3 10             	bt     %edx,(%eax)
c0103f6c:	19 c0                	sbb    %eax,%eax
c0103f6e:	89 45 a4             	mov    %eax,-0x5c(%ebp)
    return oldbit != 0;
c0103f71:	83 7d a4 00          	cmpl   $0x0,-0x5c(%ebp)
c0103f75:	0f 95 c0             	setne  %al
c0103f78:	0f b6 c0             	movzbl %al,%eax
c0103f7b:	85 c0                	test   %eax,%eax
c0103f7d:	74 0e                	je     c0103f8d <default_check+0x29d>
c0103f7f:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0103f82:	83 c0 40             	add    $0x40,%eax
c0103f85:	8b 40 08             	mov    0x8(%eax),%eax
c0103f88:	83 f8 03             	cmp    $0x3,%eax
c0103f8b:	74 24                	je     c0103fb1 <default_check+0x2c1>
c0103f8d:	c7 44 24 0c a4 96 10 	movl   $0xc01096a4,0xc(%esp)
c0103f94:	c0 
c0103f95:	c7 44 24 08 76 94 10 	movl   $0xc0109476,0x8(%esp)
c0103f9c:	c0 
c0103f9d:	c7 44 24 04 f9 00 00 	movl   $0xf9,0x4(%esp)
c0103fa4:	00 
c0103fa5:	c7 04 24 8b 94 10 c0 	movl   $0xc010948b,(%esp)
c0103fac:	e8 24 cd ff ff       	call   c0100cd5 <__panic>
    assert((p1 = alloc_pages(3)) != NULL);
c0103fb1:	c7 04 24 03 00 00 00 	movl   $0x3,(%esp)
c0103fb8:	e8 db 06 00 00       	call   c0104698 <alloc_pages>
c0103fbd:	89 45 dc             	mov    %eax,-0x24(%ebp)
c0103fc0:	83 7d dc 00          	cmpl   $0x0,-0x24(%ebp)
c0103fc4:	75 24                	jne    c0103fea <default_check+0x2fa>
c0103fc6:	c7 44 24 0c d0 96 10 	movl   $0xc01096d0,0xc(%esp)
c0103fcd:	c0 
c0103fce:	c7 44 24 08 76 94 10 	movl   $0xc0109476,0x8(%esp)
c0103fd5:	c0 
c0103fd6:	c7 44 24 04 fa 00 00 	movl   $0xfa,0x4(%esp)
c0103fdd:	00 
c0103fde:	c7 04 24 8b 94 10 c0 	movl   $0xc010948b,(%esp)
c0103fe5:	e8 eb cc ff ff       	call   c0100cd5 <__panic>
    assert(alloc_page() == NULL);
c0103fea:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0103ff1:	e8 a2 06 00 00       	call   c0104698 <alloc_pages>
c0103ff6:	85 c0                	test   %eax,%eax
c0103ff8:	74 24                	je     c010401e <default_check+0x32e>
c0103ffa:	c7 44 24 0c e6 95 10 	movl   $0xc01095e6,0xc(%esp)
c0104001:	c0 
c0104002:	c7 44 24 08 76 94 10 	movl   $0xc0109476,0x8(%esp)
c0104009:	c0 
c010400a:	c7 44 24 04 fb 00 00 	movl   $0xfb,0x4(%esp)
c0104011:	00 
c0104012:	c7 04 24 8b 94 10 c0 	movl   $0xc010948b,(%esp)
c0104019:	e8 b7 cc ff ff       	call   c0100cd5 <__panic>
    assert(p0 + 2 == p1);
c010401e:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0104021:	83 c0 40             	add    $0x40,%eax
c0104024:	3b 45 dc             	cmp    -0x24(%ebp),%eax
c0104027:	74 24                	je     c010404d <default_check+0x35d>
c0104029:	c7 44 24 0c ee 96 10 	movl   $0xc01096ee,0xc(%esp)
c0104030:	c0 
c0104031:	c7 44 24 08 76 94 10 	movl   $0xc0109476,0x8(%esp)
c0104038:	c0 
c0104039:	c7 44 24 04 fc 00 00 	movl   $0xfc,0x4(%esp)
c0104040:	00 
c0104041:	c7 04 24 8b 94 10 c0 	movl   $0xc010948b,(%esp)
c0104048:	e8 88 cc ff ff       	call   c0100cd5 <__panic>

    p2 = p0 + 1;
c010404d:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0104050:	83 c0 20             	add    $0x20,%eax
c0104053:	89 45 d8             	mov    %eax,-0x28(%ebp)
    free_page(p0);
c0104056:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c010405d:	00 
c010405e:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0104061:	89 04 24             	mov    %eax,(%esp)
c0104064:	e8 9a 06 00 00       	call   c0104703 <free_pages>
    free_pages(p1, 3);
c0104069:	c7 44 24 04 03 00 00 	movl   $0x3,0x4(%esp)
c0104070:	00 
c0104071:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0104074:	89 04 24             	mov    %eax,(%esp)
c0104077:	e8 87 06 00 00       	call   c0104703 <free_pages>
    assert(PageProperty(p0) && p0->property == 1);
c010407c:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c010407f:	83 c0 04             	add    $0x4,%eax
c0104082:	c7 45 a0 01 00 00 00 	movl   $0x1,-0x60(%ebp)
c0104089:	89 45 9c             	mov    %eax,-0x64(%ebp)
 * @addr:   the address to count from
 * */
static inline bool
test_bit(int nr, volatile void *addr) {
    int oldbit;
    asm volatile ("btl %2, %1; sbbl %0,%0" : "=r" (oldbit) : "m" (*(volatile long *)addr), "Ir" (nr));
c010408c:	8b 45 9c             	mov    -0x64(%ebp),%eax
c010408f:	8b 55 a0             	mov    -0x60(%ebp),%edx
c0104092:	0f a3 10             	bt     %edx,(%eax)
c0104095:	19 c0                	sbb    %eax,%eax
c0104097:	89 45 98             	mov    %eax,-0x68(%ebp)
    return oldbit != 0;
c010409a:	83 7d 98 00          	cmpl   $0x0,-0x68(%ebp)
c010409e:	0f 95 c0             	setne  %al
c01040a1:	0f b6 c0             	movzbl %al,%eax
c01040a4:	85 c0                	test   %eax,%eax
c01040a6:	74 0b                	je     c01040b3 <default_check+0x3c3>
c01040a8:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c01040ab:	8b 40 08             	mov    0x8(%eax),%eax
c01040ae:	83 f8 01             	cmp    $0x1,%eax
c01040b1:	74 24                	je     c01040d7 <default_check+0x3e7>
c01040b3:	c7 44 24 0c fc 96 10 	movl   $0xc01096fc,0xc(%esp)
c01040ba:	c0 
c01040bb:	c7 44 24 08 76 94 10 	movl   $0xc0109476,0x8(%esp)
c01040c2:	c0 
c01040c3:	c7 44 24 04 01 01 00 	movl   $0x101,0x4(%esp)
c01040ca:	00 
c01040cb:	c7 04 24 8b 94 10 c0 	movl   $0xc010948b,(%esp)
c01040d2:	e8 fe cb ff ff       	call   c0100cd5 <__panic>
    assert(PageProperty(p1) && p1->property == 3);
c01040d7:	8b 45 dc             	mov    -0x24(%ebp),%eax
c01040da:	83 c0 04             	add    $0x4,%eax
c01040dd:	c7 45 94 01 00 00 00 	movl   $0x1,-0x6c(%ebp)
c01040e4:	89 45 90             	mov    %eax,-0x70(%ebp)
 * @addr:   the address to count from
 * */
static inline bool
test_bit(int nr, volatile void *addr) {
    int oldbit;
    asm volatile ("btl %2, %1; sbbl %0,%0" : "=r" (oldbit) : "m" (*(volatile long *)addr), "Ir" (nr));
c01040e7:	8b 45 90             	mov    -0x70(%ebp),%eax
c01040ea:	8b 55 94             	mov    -0x6c(%ebp),%edx
c01040ed:	0f a3 10             	bt     %edx,(%eax)
c01040f0:	19 c0                	sbb    %eax,%eax
c01040f2:	89 45 8c             	mov    %eax,-0x74(%ebp)
    return oldbit != 0;
c01040f5:	83 7d 8c 00          	cmpl   $0x0,-0x74(%ebp)
c01040f9:	0f 95 c0             	setne  %al
c01040fc:	0f b6 c0             	movzbl %al,%eax
c01040ff:	85 c0                	test   %eax,%eax
c0104101:	74 0b                	je     c010410e <default_check+0x41e>
c0104103:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0104106:	8b 40 08             	mov    0x8(%eax),%eax
c0104109:	83 f8 03             	cmp    $0x3,%eax
c010410c:	74 24                	je     c0104132 <default_check+0x442>
c010410e:	c7 44 24 0c 24 97 10 	movl   $0xc0109724,0xc(%esp)
c0104115:	c0 
c0104116:	c7 44 24 08 76 94 10 	movl   $0xc0109476,0x8(%esp)
c010411d:	c0 
c010411e:	c7 44 24 04 02 01 00 	movl   $0x102,0x4(%esp)
c0104125:	00 
c0104126:	c7 04 24 8b 94 10 c0 	movl   $0xc010948b,(%esp)
c010412d:	e8 a3 cb ff ff       	call   c0100cd5 <__panic>

    assert((p0 = alloc_page()) == p2 - 1);
c0104132:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0104139:	e8 5a 05 00 00       	call   c0104698 <alloc_pages>
c010413e:	89 45 e4             	mov    %eax,-0x1c(%ebp)
c0104141:	8b 45 d8             	mov    -0x28(%ebp),%eax
c0104144:	83 e8 20             	sub    $0x20,%eax
c0104147:	39 45 e4             	cmp    %eax,-0x1c(%ebp)
c010414a:	74 24                	je     c0104170 <default_check+0x480>
c010414c:	c7 44 24 0c 4a 97 10 	movl   $0xc010974a,0xc(%esp)
c0104153:	c0 
c0104154:	c7 44 24 08 76 94 10 	movl   $0xc0109476,0x8(%esp)
c010415b:	c0 
c010415c:	c7 44 24 04 04 01 00 	movl   $0x104,0x4(%esp)
c0104163:	00 
c0104164:	c7 04 24 8b 94 10 c0 	movl   $0xc010948b,(%esp)
c010416b:	e8 65 cb ff ff       	call   c0100cd5 <__panic>
    free_page(p0);
c0104170:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c0104177:	00 
c0104178:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c010417b:	89 04 24             	mov    %eax,(%esp)
c010417e:	e8 80 05 00 00       	call   c0104703 <free_pages>
    assert((p0 = alloc_pages(2)) == p2 + 1);
c0104183:	c7 04 24 02 00 00 00 	movl   $0x2,(%esp)
c010418a:	e8 09 05 00 00       	call   c0104698 <alloc_pages>
c010418f:	89 45 e4             	mov    %eax,-0x1c(%ebp)
c0104192:	8b 45 d8             	mov    -0x28(%ebp),%eax
c0104195:	83 c0 20             	add    $0x20,%eax
c0104198:	39 45 e4             	cmp    %eax,-0x1c(%ebp)
c010419b:	74 24                	je     c01041c1 <default_check+0x4d1>
c010419d:	c7 44 24 0c 68 97 10 	movl   $0xc0109768,0xc(%esp)
c01041a4:	c0 
c01041a5:	c7 44 24 08 76 94 10 	movl   $0xc0109476,0x8(%esp)
c01041ac:	c0 
c01041ad:	c7 44 24 04 06 01 00 	movl   $0x106,0x4(%esp)
c01041b4:	00 
c01041b5:	c7 04 24 8b 94 10 c0 	movl   $0xc010948b,(%esp)
c01041bc:	e8 14 cb ff ff       	call   c0100cd5 <__panic>

    free_pages(p0, 2);
c01041c1:	c7 44 24 04 02 00 00 	movl   $0x2,0x4(%esp)
c01041c8:	00 
c01041c9:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c01041cc:	89 04 24             	mov    %eax,(%esp)
c01041cf:	e8 2f 05 00 00       	call   c0104703 <free_pages>
    free_page(p2);
c01041d4:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c01041db:	00 
c01041dc:	8b 45 d8             	mov    -0x28(%ebp),%eax
c01041df:	89 04 24             	mov    %eax,(%esp)
c01041e2:	e8 1c 05 00 00       	call   c0104703 <free_pages>

    assert((p0 = alloc_pages(5)) != NULL);
c01041e7:	c7 04 24 05 00 00 00 	movl   $0x5,(%esp)
c01041ee:	e8 a5 04 00 00       	call   c0104698 <alloc_pages>
c01041f3:	89 45 e4             	mov    %eax,-0x1c(%ebp)
c01041f6:	83 7d e4 00          	cmpl   $0x0,-0x1c(%ebp)
c01041fa:	75 24                	jne    c0104220 <default_check+0x530>
c01041fc:	c7 44 24 0c 88 97 10 	movl   $0xc0109788,0xc(%esp)
c0104203:	c0 
c0104204:	c7 44 24 08 76 94 10 	movl   $0xc0109476,0x8(%esp)
c010420b:	c0 
c010420c:	c7 44 24 04 0b 01 00 	movl   $0x10b,0x4(%esp)
c0104213:	00 
c0104214:	c7 04 24 8b 94 10 c0 	movl   $0xc010948b,(%esp)
c010421b:	e8 b5 ca ff ff       	call   c0100cd5 <__panic>
    assert(alloc_page() == NULL);
c0104220:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0104227:	e8 6c 04 00 00       	call   c0104698 <alloc_pages>
c010422c:	85 c0                	test   %eax,%eax
c010422e:	74 24                	je     c0104254 <default_check+0x564>
c0104230:	c7 44 24 0c e6 95 10 	movl   $0xc01095e6,0xc(%esp)
c0104237:	c0 
c0104238:	c7 44 24 08 76 94 10 	movl   $0xc0109476,0x8(%esp)
c010423f:	c0 
c0104240:	c7 44 24 04 0c 01 00 	movl   $0x10c,0x4(%esp)
c0104247:	00 
c0104248:	c7 04 24 8b 94 10 c0 	movl   $0xc010948b,(%esp)
c010424f:	e8 81 ca ff ff       	call   c0100cd5 <__panic>

    assert(nr_free == 0);
c0104254:	a1 c8 1a 12 c0       	mov    0xc0121ac8,%eax
c0104259:	85 c0                	test   %eax,%eax
c010425b:	74 24                	je     c0104281 <default_check+0x591>
c010425d:	c7 44 24 0c 39 96 10 	movl   $0xc0109639,0xc(%esp)
c0104264:	c0 
c0104265:	c7 44 24 08 76 94 10 	movl   $0xc0109476,0x8(%esp)
c010426c:	c0 
c010426d:	c7 44 24 04 0e 01 00 	movl   $0x10e,0x4(%esp)
c0104274:	00 
c0104275:	c7 04 24 8b 94 10 c0 	movl   $0xc010948b,(%esp)
c010427c:	e8 54 ca ff ff       	call   c0100cd5 <__panic>
    nr_free = nr_free_store;
c0104281:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0104284:	a3 c8 1a 12 c0       	mov    %eax,0xc0121ac8

    free_list = free_list_store;
c0104289:	8b 45 80             	mov    -0x80(%ebp),%eax
c010428c:	8b 55 84             	mov    -0x7c(%ebp),%edx
c010428f:	a3 c0 1a 12 c0       	mov    %eax,0xc0121ac0
c0104294:	89 15 c4 1a 12 c0    	mov    %edx,0xc0121ac4
    free_pages(p0, 5);
c010429a:	c7 44 24 04 05 00 00 	movl   $0x5,0x4(%esp)
c01042a1:	00 
c01042a2:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c01042a5:	89 04 24             	mov    %eax,(%esp)
c01042a8:	e8 56 04 00 00       	call   c0104703 <free_pages>

    le = &free_list;
c01042ad:	c7 45 ec c0 1a 12 c0 	movl   $0xc0121ac0,-0x14(%ebp)
    while ((le = list_next(le)) != &free_list) {
c01042b4:	eb 1d                	jmp    c01042d3 <default_check+0x5e3>
        struct Page *p = le2page(le, page_link);
c01042b6:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01042b9:	83 e8 0c             	sub    $0xc,%eax
c01042bc:	89 45 d4             	mov    %eax,-0x2c(%ebp)
        count --, total -= p->property;
c01042bf:	83 6d f4 01          	subl   $0x1,-0xc(%ebp)
c01042c3:	8b 55 f0             	mov    -0x10(%ebp),%edx
c01042c6:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c01042c9:	8b 40 08             	mov    0x8(%eax),%eax
c01042cc:	29 c2                	sub    %eax,%edx
c01042ce:	89 d0                	mov    %edx,%eax
c01042d0:	89 45 f0             	mov    %eax,-0x10(%ebp)
c01042d3:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01042d6:	89 45 88             	mov    %eax,-0x78(%ebp)
 * list_next - get the next entry
 * @listelm:    the list head
 **/
static inline list_entry_t *
list_next(list_entry_t *listelm) {
    return listelm->next;
c01042d9:	8b 45 88             	mov    -0x78(%ebp),%eax
c01042dc:	8b 40 04             	mov    0x4(%eax),%eax

    free_list = free_list_store;
    free_pages(p0, 5);

    le = &free_list;
    while ((le = list_next(le)) != &free_list) {
c01042df:	89 45 ec             	mov    %eax,-0x14(%ebp)
c01042e2:	81 7d ec c0 1a 12 c0 	cmpl   $0xc0121ac0,-0x14(%ebp)
c01042e9:	75 cb                	jne    c01042b6 <default_check+0x5c6>
        struct Page *p = le2page(le, page_link);
        count --, total -= p->property;
    }
    assert(count == 0);
c01042eb:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c01042ef:	74 24                	je     c0104315 <default_check+0x625>
c01042f1:	c7 44 24 0c a6 97 10 	movl   $0xc01097a6,0xc(%esp)
c01042f8:	c0 
c01042f9:	c7 44 24 08 76 94 10 	movl   $0xc0109476,0x8(%esp)
c0104300:	c0 
c0104301:	c7 44 24 04 19 01 00 	movl   $0x119,0x4(%esp)
c0104308:	00 
c0104309:	c7 04 24 8b 94 10 c0 	movl   $0xc010948b,(%esp)
c0104310:	e8 c0 c9 ff ff       	call   c0100cd5 <__panic>
    assert(total == 0);
c0104315:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c0104319:	74 24                	je     c010433f <default_check+0x64f>
c010431b:	c7 44 24 0c b1 97 10 	movl   $0xc01097b1,0xc(%esp)
c0104322:	c0 
c0104323:	c7 44 24 08 76 94 10 	movl   $0xc0109476,0x8(%esp)
c010432a:	c0 
c010432b:	c7 44 24 04 1a 01 00 	movl   $0x11a,0x4(%esp)
c0104332:	00 
c0104333:	c7 04 24 8b 94 10 c0 	movl   $0xc010948b,(%esp)
c010433a:	e8 96 c9 ff ff       	call   c0100cd5 <__panic>
}
c010433f:	81 c4 94 00 00 00    	add    $0x94,%esp
c0104345:	5b                   	pop    %ebx
c0104346:	5d                   	pop    %ebp
c0104347:	c3                   	ret    

c0104348 <page2ppn>:

extern struct Page *pages;
extern size_t npage;

static inline ppn_t
page2ppn(struct Page *page) {
c0104348:	55                   	push   %ebp
c0104349:	89 e5                	mov    %esp,%ebp
    return page - pages;
c010434b:	8b 55 08             	mov    0x8(%ebp),%edx
c010434e:	a1 d4 1a 12 c0       	mov    0xc0121ad4,%eax
c0104353:	29 c2                	sub    %eax,%edx
c0104355:	89 d0                	mov    %edx,%eax
c0104357:	c1 f8 05             	sar    $0x5,%eax
}
c010435a:	5d                   	pop    %ebp
c010435b:	c3                   	ret    

c010435c <page2pa>:

static inline uintptr_t
page2pa(struct Page *page) {
c010435c:	55                   	push   %ebp
c010435d:	89 e5                	mov    %esp,%ebp
c010435f:	83 ec 04             	sub    $0x4,%esp
    return page2ppn(page) << PGSHIFT;
c0104362:	8b 45 08             	mov    0x8(%ebp),%eax
c0104365:	89 04 24             	mov    %eax,(%esp)
c0104368:	e8 db ff ff ff       	call   c0104348 <page2ppn>
c010436d:	c1 e0 0c             	shl    $0xc,%eax
}
c0104370:	c9                   	leave  
c0104371:	c3                   	ret    

c0104372 <pa2page>:

static inline struct Page *
pa2page(uintptr_t pa) {
c0104372:	55                   	push   %ebp
c0104373:	89 e5                	mov    %esp,%ebp
c0104375:	83 ec 18             	sub    $0x18,%esp
    if (PPN(pa) >= npage) {
c0104378:	8b 45 08             	mov    0x8(%ebp),%eax
c010437b:	c1 e8 0c             	shr    $0xc,%eax
c010437e:	89 c2                	mov    %eax,%edx
c0104380:	a1 20 1a 12 c0       	mov    0xc0121a20,%eax
c0104385:	39 c2                	cmp    %eax,%edx
c0104387:	72 1c                	jb     c01043a5 <pa2page+0x33>
        panic("pa2page called with invalid pa");
c0104389:	c7 44 24 08 ec 97 10 	movl   $0xc01097ec,0x8(%esp)
c0104390:	c0 
c0104391:	c7 44 24 04 5b 00 00 	movl   $0x5b,0x4(%esp)
c0104398:	00 
c0104399:	c7 04 24 0b 98 10 c0 	movl   $0xc010980b,(%esp)
c01043a0:	e8 30 c9 ff ff       	call   c0100cd5 <__panic>
    }
    return &pages[PPN(pa)];
c01043a5:	a1 d4 1a 12 c0       	mov    0xc0121ad4,%eax
c01043aa:	8b 55 08             	mov    0x8(%ebp),%edx
c01043ad:	c1 ea 0c             	shr    $0xc,%edx
c01043b0:	c1 e2 05             	shl    $0x5,%edx
c01043b3:	01 d0                	add    %edx,%eax
}
c01043b5:	c9                   	leave  
c01043b6:	c3                   	ret    

c01043b7 <page2kva>:

static inline void *
page2kva(struct Page *page) {
c01043b7:	55                   	push   %ebp
c01043b8:	89 e5                	mov    %esp,%ebp
c01043ba:	83 ec 28             	sub    $0x28,%esp
    return KADDR(page2pa(page));
c01043bd:	8b 45 08             	mov    0x8(%ebp),%eax
c01043c0:	89 04 24             	mov    %eax,(%esp)
c01043c3:	e8 94 ff ff ff       	call   c010435c <page2pa>
c01043c8:	89 45 f4             	mov    %eax,-0xc(%ebp)
c01043cb:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01043ce:	c1 e8 0c             	shr    $0xc,%eax
c01043d1:	89 45 f0             	mov    %eax,-0x10(%ebp)
c01043d4:	a1 20 1a 12 c0       	mov    0xc0121a20,%eax
c01043d9:	39 45 f0             	cmp    %eax,-0x10(%ebp)
c01043dc:	72 23                	jb     c0104401 <page2kva+0x4a>
c01043de:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01043e1:	89 44 24 0c          	mov    %eax,0xc(%esp)
c01043e5:	c7 44 24 08 1c 98 10 	movl   $0xc010981c,0x8(%esp)
c01043ec:	c0 
c01043ed:	c7 44 24 04 62 00 00 	movl   $0x62,0x4(%esp)
c01043f4:	00 
c01043f5:	c7 04 24 0b 98 10 c0 	movl   $0xc010980b,(%esp)
c01043fc:	e8 d4 c8 ff ff       	call   c0100cd5 <__panic>
c0104401:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0104404:	2d 00 00 00 40       	sub    $0x40000000,%eax
}
c0104409:	c9                   	leave  
c010440a:	c3                   	ret    

c010440b <kva2page>:

static inline struct Page *
kva2page(void *kva) {
c010440b:	55                   	push   %ebp
c010440c:	89 e5                	mov    %esp,%ebp
c010440e:	83 ec 28             	sub    $0x28,%esp
    return pa2page(PADDR(kva));
c0104411:	8b 45 08             	mov    0x8(%ebp),%eax
c0104414:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0104417:	81 7d f4 ff ff ff bf 	cmpl   $0xbfffffff,-0xc(%ebp)
c010441e:	77 23                	ja     c0104443 <kva2page+0x38>
c0104420:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0104423:	89 44 24 0c          	mov    %eax,0xc(%esp)
c0104427:	c7 44 24 08 40 98 10 	movl   $0xc0109840,0x8(%esp)
c010442e:	c0 
c010442f:	c7 44 24 04 67 00 00 	movl   $0x67,0x4(%esp)
c0104436:	00 
c0104437:	c7 04 24 0b 98 10 c0 	movl   $0xc010980b,(%esp)
c010443e:	e8 92 c8 ff ff       	call   c0100cd5 <__panic>
c0104443:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0104446:	05 00 00 00 40       	add    $0x40000000,%eax
c010444b:	89 04 24             	mov    %eax,(%esp)
c010444e:	e8 1f ff ff ff       	call   c0104372 <pa2page>
}
c0104453:	c9                   	leave  
c0104454:	c3                   	ret    

c0104455 <pte2page>:

static inline struct Page *
pte2page(pte_t pte) {
c0104455:	55                   	push   %ebp
c0104456:	89 e5                	mov    %esp,%ebp
c0104458:	83 ec 18             	sub    $0x18,%esp
    if (!(pte & PTE_P)) {
c010445b:	8b 45 08             	mov    0x8(%ebp),%eax
c010445e:	83 e0 01             	and    $0x1,%eax
c0104461:	85 c0                	test   %eax,%eax
c0104463:	75 1c                	jne    c0104481 <pte2page+0x2c>
        panic("pte2page called with invalid pte");
c0104465:	c7 44 24 08 64 98 10 	movl   $0xc0109864,0x8(%esp)
c010446c:	c0 
c010446d:	c7 44 24 04 6d 00 00 	movl   $0x6d,0x4(%esp)
c0104474:	00 
c0104475:	c7 04 24 0b 98 10 c0 	movl   $0xc010980b,(%esp)
c010447c:	e8 54 c8 ff ff       	call   c0100cd5 <__panic>
    }
    return pa2page(PTE_ADDR(pte));
c0104481:	8b 45 08             	mov    0x8(%ebp),%eax
c0104484:	25 00 f0 ff ff       	and    $0xfffff000,%eax
c0104489:	89 04 24             	mov    %eax,(%esp)
c010448c:	e8 e1 fe ff ff       	call   c0104372 <pa2page>
}
c0104491:	c9                   	leave  
c0104492:	c3                   	ret    

c0104493 <page_ref>:
pde2page(pde_t pde) {
    return pa2page(PDE_ADDR(pde));
}

static inline int
page_ref(struct Page *page) {
c0104493:	55                   	push   %ebp
c0104494:	89 e5                	mov    %esp,%ebp
    return page->ref;
c0104496:	8b 45 08             	mov    0x8(%ebp),%eax
c0104499:	8b 00                	mov    (%eax),%eax
}
c010449b:	5d                   	pop    %ebp
c010449c:	c3                   	ret    

c010449d <set_page_ref>:

static inline void
set_page_ref(struct Page *page, int val) {
c010449d:	55                   	push   %ebp
c010449e:	89 e5                	mov    %esp,%ebp
    page->ref = val;
c01044a0:	8b 45 08             	mov    0x8(%ebp),%eax
c01044a3:	8b 55 0c             	mov    0xc(%ebp),%edx
c01044a6:	89 10                	mov    %edx,(%eax)
}
c01044a8:	5d                   	pop    %ebp
c01044a9:	c3                   	ret    

c01044aa <page_ref_inc>:

static inline int
page_ref_inc(struct Page *page) {
c01044aa:	55                   	push   %ebp
c01044ab:	89 e5                	mov    %esp,%ebp
    page->ref += 1;
c01044ad:	8b 45 08             	mov    0x8(%ebp),%eax
c01044b0:	8b 00                	mov    (%eax),%eax
c01044b2:	8d 50 01             	lea    0x1(%eax),%edx
c01044b5:	8b 45 08             	mov    0x8(%ebp),%eax
c01044b8:	89 10                	mov    %edx,(%eax)
    return page->ref;
c01044ba:	8b 45 08             	mov    0x8(%ebp),%eax
c01044bd:	8b 00                	mov    (%eax),%eax
}
c01044bf:	5d                   	pop    %ebp
c01044c0:	c3                   	ret    

c01044c1 <page_ref_dec>:

static inline int
page_ref_dec(struct Page *page) {
c01044c1:	55                   	push   %ebp
c01044c2:	89 e5                	mov    %esp,%ebp
    page->ref -= 1;
c01044c4:	8b 45 08             	mov    0x8(%ebp),%eax
c01044c7:	8b 00                	mov    (%eax),%eax
c01044c9:	8d 50 ff             	lea    -0x1(%eax),%edx
c01044cc:	8b 45 08             	mov    0x8(%ebp),%eax
c01044cf:	89 10                	mov    %edx,(%eax)
    return page->ref;
c01044d1:	8b 45 08             	mov    0x8(%ebp),%eax
c01044d4:	8b 00                	mov    (%eax),%eax
}
c01044d6:	5d                   	pop    %ebp
c01044d7:	c3                   	ret    

c01044d8 <__intr_save>:
#include <x86.h>
#include <intr.h>
#include <mmu.h>

static inline bool
__intr_save(void) {
c01044d8:	55                   	push   %ebp
c01044d9:	89 e5                	mov    %esp,%ebp
c01044db:	83 ec 18             	sub    $0x18,%esp
}

static inline uint32_t
read_eflags(void) {
    uint32_t eflags;
    asm volatile ("pushfl; popl %0" : "=r" (eflags));
c01044de:	9c                   	pushf  
c01044df:	58                   	pop    %eax
c01044e0:	89 45 f4             	mov    %eax,-0xc(%ebp)
    return eflags;
c01044e3:	8b 45 f4             	mov    -0xc(%ebp),%eax
    if (read_eflags() & FL_IF) {
c01044e6:	25 00 02 00 00       	and    $0x200,%eax
c01044eb:	85 c0                	test   %eax,%eax
c01044ed:	74 0c                	je     c01044fb <__intr_save+0x23>
        intr_disable();
c01044ef:	e8 39 da ff ff       	call   c0101f2d <intr_disable>
        return 1;
c01044f4:	b8 01 00 00 00       	mov    $0x1,%eax
c01044f9:	eb 05                	jmp    c0104500 <__intr_save+0x28>
    }
    return 0;
c01044fb:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0104500:	c9                   	leave  
c0104501:	c3                   	ret    

c0104502 <__intr_restore>:

static inline void
__intr_restore(bool flag) {
c0104502:	55                   	push   %ebp
c0104503:	89 e5                	mov    %esp,%ebp
c0104505:	83 ec 08             	sub    $0x8,%esp
    if (flag) {
c0104508:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
c010450c:	74 05                	je     c0104513 <__intr_restore+0x11>
        intr_enable();
c010450e:	e8 14 da ff ff       	call   c0101f27 <intr_enable>
    }
}
c0104513:	c9                   	leave  
c0104514:	c3                   	ret    

c0104515 <lgdt>:
/* *
 * lgdt - load the global descriptor table register and reset the
 * data/code segement registers for kernel.
 * */
static inline void
lgdt(struct pseudodesc *pd) {
c0104515:	55                   	push   %ebp
c0104516:	89 e5                	mov    %esp,%ebp
    asm volatile ("lgdt (%0)" :: "r" (pd));
c0104518:	8b 45 08             	mov    0x8(%ebp),%eax
c010451b:	0f 01 10             	lgdtl  (%eax)
    asm volatile ("movw %%ax, %%gs" :: "a" (USER_DS));
c010451e:	b8 23 00 00 00       	mov    $0x23,%eax
c0104523:	8e e8                	mov    %eax,%gs
    asm volatile ("movw %%ax, %%fs" :: "a" (USER_DS));
c0104525:	b8 23 00 00 00       	mov    $0x23,%eax
c010452a:	8e e0                	mov    %eax,%fs
    asm volatile ("movw %%ax, %%es" :: "a" (KERNEL_DS));
c010452c:	b8 10 00 00 00       	mov    $0x10,%eax
c0104531:	8e c0                	mov    %eax,%es
    asm volatile ("movw %%ax, %%ds" :: "a" (KERNEL_DS));
c0104533:	b8 10 00 00 00       	mov    $0x10,%eax
c0104538:	8e d8                	mov    %eax,%ds
    asm volatile ("movw %%ax, %%ss" :: "a" (KERNEL_DS));
c010453a:	b8 10 00 00 00       	mov    $0x10,%eax
c010453f:	8e d0                	mov    %eax,%ss
    // reload cs
    asm volatile ("ljmp %0, $1f\n 1:\n" :: "i" (KERNEL_CS));
c0104541:	ea 48 45 10 c0 08 00 	ljmp   $0x8,$0xc0104548
}
c0104548:	5d                   	pop    %ebp
c0104549:	c3                   	ret    

c010454a <load_esp0>:
 * load_esp0 - change the ESP0 in default task state segment,
 * so that we can use different kernel stack when we trap frame
 * user to kernel.
 * */
void
load_esp0(uintptr_t esp0) {
c010454a:	55                   	push   %ebp
c010454b:	89 e5                	mov    %esp,%ebp
    ts.ts_esp0 = esp0;
c010454d:	8b 45 08             	mov    0x8(%ebp),%eax
c0104550:	a3 44 1a 12 c0       	mov    %eax,0xc0121a44
}
c0104555:	5d                   	pop    %ebp
c0104556:	c3                   	ret    

c0104557 <gdt_init>:

/* gdt_init - initialize the default GDT and TSS */
static void
gdt_init(void) {
c0104557:	55                   	push   %ebp
c0104558:	89 e5                	mov    %esp,%ebp
c010455a:	83 ec 14             	sub    $0x14,%esp
    // set boot kernel stack and default SS0
    load_esp0((uintptr_t)bootstacktop);
c010455d:	b8 00 00 12 c0       	mov    $0xc0120000,%eax
c0104562:	89 04 24             	mov    %eax,(%esp)
c0104565:	e8 e0 ff ff ff       	call   c010454a <load_esp0>
    ts.ts_ss0 = KERNEL_DS;
c010456a:	66 c7 05 48 1a 12 c0 	movw   $0x10,0xc0121a48
c0104571:	10 00 

    // initialize the TSS filed of the gdt
    gdt[SEG_TSS] = SEGTSS(STS_T32A, (uintptr_t)&ts, sizeof(ts), DPL_KERNEL);
c0104573:	66 c7 05 28 0a 12 c0 	movw   $0x68,0xc0120a28
c010457a:	68 00 
c010457c:	b8 40 1a 12 c0       	mov    $0xc0121a40,%eax
c0104581:	66 a3 2a 0a 12 c0    	mov    %ax,0xc0120a2a
c0104587:	b8 40 1a 12 c0       	mov    $0xc0121a40,%eax
c010458c:	c1 e8 10             	shr    $0x10,%eax
c010458f:	a2 2c 0a 12 c0       	mov    %al,0xc0120a2c
c0104594:	0f b6 05 2d 0a 12 c0 	movzbl 0xc0120a2d,%eax
c010459b:	83 e0 f0             	and    $0xfffffff0,%eax
c010459e:	83 c8 09             	or     $0x9,%eax
c01045a1:	a2 2d 0a 12 c0       	mov    %al,0xc0120a2d
c01045a6:	0f b6 05 2d 0a 12 c0 	movzbl 0xc0120a2d,%eax
c01045ad:	83 e0 ef             	and    $0xffffffef,%eax
c01045b0:	a2 2d 0a 12 c0       	mov    %al,0xc0120a2d
c01045b5:	0f b6 05 2d 0a 12 c0 	movzbl 0xc0120a2d,%eax
c01045bc:	83 e0 9f             	and    $0xffffff9f,%eax
c01045bf:	a2 2d 0a 12 c0       	mov    %al,0xc0120a2d
c01045c4:	0f b6 05 2d 0a 12 c0 	movzbl 0xc0120a2d,%eax
c01045cb:	83 c8 80             	or     $0xffffff80,%eax
c01045ce:	a2 2d 0a 12 c0       	mov    %al,0xc0120a2d
c01045d3:	0f b6 05 2e 0a 12 c0 	movzbl 0xc0120a2e,%eax
c01045da:	83 e0 f0             	and    $0xfffffff0,%eax
c01045dd:	a2 2e 0a 12 c0       	mov    %al,0xc0120a2e
c01045e2:	0f b6 05 2e 0a 12 c0 	movzbl 0xc0120a2e,%eax
c01045e9:	83 e0 ef             	and    $0xffffffef,%eax
c01045ec:	a2 2e 0a 12 c0       	mov    %al,0xc0120a2e
c01045f1:	0f b6 05 2e 0a 12 c0 	movzbl 0xc0120a2e,%eax
c01045f8:	83 e0 df             	and    $0xffffffdf,%eax
c01045fb:	a2 2e 0a 12 c0       	mov    %al,0xc0120a2e
c0104600:	0f b6 05 2e 0a 12 c0 	movzbl 0xc0120a2e,%eax
c0104607:	83 c8 40             	or     $0x40,%eax
c010460a:	a2 2e 0a 12 c0       	mov    %al,0xc0120a2e
c010460f:	0f b6 05 2e 0a 12 c0 	movzbl 0xc0120a2e,%eax
c0104616:	83 e0 7f             	and    $0x7f,%eax
c0104619:	a2 2e 0a 12 c0       	mov    %al,0xc0120a2e
c010461e:	b8 40 1a 12 c0       	mov    $0xc0121a40,%eax
c0104623:	c1 e8 18             	shr    $0x18,%eax
c0104626:	a2 2f 0a 12 c0       	mov    %al,0xc0120a2f

    // reload all segment registers
    lgdt(&gdt_pd);
c010462b:	c7 04 24 30 0a 12 c0 	movl   $0xc0120a30,(%esp)
c0104632:	e8 de fe ff ff       	call   c0104515 <lgdt>
c0104637:	66 c7 45 fe 28 00    	movw   $0x28,-0x2(%ebp)
    asm volatile ("cli" ::: "memory");
}

static inline void
ltr(uint16_t sel) {
    asm volatile ("ltr %0" :: "r" (sel) : "memory");
c010463d:	0f b7 45 fe          	movzwl -0x2(%ebp),%eax
c0104641:	0f 00 d8             	ltr    %ax

    // load the TSS
    ltr(GD_TSS);
}
c0104644:	c9                   	leave  
c0104645:	c3                   	ret    

c0104646 <init_pmm_manager>:

//init_pmm_manager - initialize a pmm_manager instance
static void
init_pmm_manager(void) {
c0104646:	55                   	push   %ebp
c0104647:	89 e5                	mov    %esp,%ebp
c0104649:	83 ec 18             	sub    $0x18,%esp
    pmm_manager = &default_pmm_manager;
c010464c:	c7 05 cc 1a 12 c0 d0 	movl   $0xc01097d0,0xc0121acc
c0104653:	97 10 c0 
    cprintf("memory management: %s\n", pmm_manager->name);
c0104656:	a1 cc 1a 12 c0       	mov    0xc0121acc,%eax
c010465b:	8b 00                	mov    (%eax),%eax
c010465d:	89 44 24 04          	mov    %eax,0x4(%esp)
c0104661:	c7 04 24 90 98 10 c0 	movl   $0xc0109890,(%esp)
c0104668:	e8 de bc ff ff       	call   c010034b <cprintf>
    pmm_manager->init();
c010466d:	a1 cc 1a 12 c0       	mov    0xc0121acc,%eax
c0104672:	8b 40 04             	mov    0x4(%eax),%eax
c0104675:	ff d0                	call   *%eax
}
c0104677:	c9                   	leave  
c0104678:	c3                   	ret    

c0104679 <init_memmap>:

//init_memmap - call pmm->init_memmap to build Page struct for free memory  
static void
init_memmap(struct Page *base, size_t n) {
c0104679:	55                   	push   %ebp
c010467a:	89 e5                	mov    %esp,%ebp
c010467c:	83 ec 18             	sub    $0x18,%esp
    pmm_manager->init_memmap(base, n);
c010467f:	a1 cc 1a 12 c0       	mov    0xc0121acc,%eax
c0104684:	8b 40 08             	mov    0x8(%eax),%eax
c0104687:	8b 55 0c             	mov    0xc(%ebp),%edx
c010468a:	89 54 24 04          	mov    %edx,0x4(%esp)
c010468e:	8b 55 08             	mov    0x8(%ebp),%edx
c0104691:	89 14 24             	mov    %edx,(%esp)
c0104694:	ff d0                	call   *%eax
}
c0104696:	c9                   	leave  
c0104697:	c3                   	ret    

c0104698 <alloc_pages>:

//alloc_pages - call pmm->alloc_pages to allocate a continuous n*PAGESIZE memory 
struct Page *
alloc_pages(size_t n) {
c0104698:	55                   	push   %ebp
c0104699:	89 e5                	mov    %esp,%ebp
c010469b:	83 ec 28             	sub    $0x28,%esp
    struct Page *page=NULL;
c010469e:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
    bool intr_flag;
    
    while (1)
    {
         local_intr_save(intr_flag);
c01046a5:	e8 2e fe ff ff       	call   c01044d8 <__intr_save>
c01046aa:	89 45 f0             	mov    %eax,-0x10(%ebp)
         {
              page = pmm_manager->alloc_pages(n);
c01046ad:	a1 cc 1a 12 c0       	mov    0xc0121acc,%eax
c01046b2:	8b 40 0c             	mov    0xc(%eax),%eax
c01046b5:	8b 55 08             	mov    0x8(%ebp),%edx
c01046b8:	89 14 24             	mov    %edx,(%esp)
c01046bb:	ff d0                	call   *%eax
c01046bd:	89 45 f4             	mov    %eax,-0xc(%ebp)
         }
         local_intr_restore(intr_flag);
c01046c0:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01046c3:	89 04 24             	mov    %eax,(%esp)
c01046c6:	e8 37 fe ff ff       	call   c0104502 <__intr_restore>

         if (page != NULL || n > 1 || swap_init_ok == 0) break;
c01046cb:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c01046cf:	75 2d                	jne    c01046fe <alloc_pages+0x66>
c01046d1:	83 7d 08 01          	cmpl   $0x1,0x8(%ebp)
c01046d5:	77 27                	ja     c01046fe <alloc_pages+0x66>
c01046d7:	a1 ac 1a 12 c0       	mov    0xc0121aac,%eax
c01046dc:	85 c0                	test   %eax,%eax
c01046de:	74 1e                	je     c01046fe <alloc_pages+0x66>
         
         extern struct mm_struct *check_mm_struct;
         //cprintf("page %x, call swap_out in alloc_pages %d\n",page, n);
         swap_out(check_mm_struct, n, 0);
c01046e0:	8b 55 08             	mov    0x8(%ebp),%edx
c01046e3:	a1 ac 1b 12 c0       	mov    0xc0121bac,%eax
c01046e8:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c01046ef:	00 
c01046f0:	89 54 24 04          	mov    %edx,0x4(%esp)
c01046f4:	89 04 24             	mov    %eax,(%esp)
c01046f7:	e8 97 1a 00 00       	call   c0106193 <swap_out>
    }
c01046fc:	eb a7                	jmp    c01046a5 <alloc_pages+0xd>
    //cprintf("n %d,get page %x, No %d in alloc_pages\n",n,page,(page-pages));
    return page;
c01046fe:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c0104701:	c9                   	leave  
c0104702:	c3                   	ret    

c0104703 <free_pages>:

//free_pages - call pmm->free_pages to free a continuous n*PAGESIZE memory 
void
free_pages(struct Page *base, size_t n) {
c0104703:	55                   	push   %ebp
c0104704:	89 e5                	mov    %esp,%ebp
c0104706:	83 ec 28             	sub    $0x28,%esp
    bool intr_flag;
    local_intr_save(intr_flag);
c0104709:	e8 ca fd ff ff       	call   c01044d8 <__intr_save>
c010470e:	89 45 f4             	mov    %eax,-0xc(%ebp)
    {
        pmm_manager->free_pages(base, n);
c0104711:	a1 cc 1a 12 c0       	mov    0xc0121acc,%eax
c0104716:	8b 40 10             	mov    0x10(%eax),%eax
c0104719:	8b 55 0c             	mov    0xc(%ebp),%edx
c010471c:	89 54 24 04          	mov    %edx,0x4(%esp)
c0104720:	8b 55 08             	mov    0x8(%ebp),%edx
c0104723:	89 14 24             	mov    %edx,(%esp)
c0104726:	ff d0                	call   *%eax
    }
    local_intr_restore(intr_flag);
c0104728:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010472b:	89 04 24             	mov    %eax,(%esp)
c010472e:	e8 cf fd ff ff       	call   c0104502 <__intr_restore>
}
c0104733:	c9                   	leave  
c0104734:	c3                   	ret    

c0104735 <nr_free_pages>:

//nr_free_pages - call pmm->nr_free_pages to get the size (nr*PAGESIZE) 
//of current free memory
size_t
nr_free_pages(void) {
c0104735:	55                   	push   %ebp
c0104736:	89 e5                	mov    %esp,%ebp
c0104738:	83 ec 28             	sub    $0x28,%esp
    size_t ret;
    bool intr_flag;
    local_intr_save(intr_flag);
c010473b:	e8 98 fd ff ff       	call   c01044d8 <__intr_save>
c0104740:	89 45 f4             	mov    %eax,-0xc(%ebp)
    {
        ret = pmm_manager->nr_free_pages();
c0104743:	a1 cc 1a 12 c0       	mov    0xc0121acc,%eax
c0104748:	8b 40 14             	mov    0x14(%eax),%eax
c010474b:	ff d0                	call   *%eax
c010474d:	89 45 f0             	mov    %eax,-0x10(%ebp)
    }
    local_intr_restore(intr_flag);
c0104750:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0104753:	89 04 24             	mov    %eax,(%esp)
c0104756:	e8 a7 fd ff ff       	call   c0104502 <__intr_restore>
    return ret;
c010475b:	8b 45 f0             	mov    -0x10(%ebp),%eax
}
c010475e:	c9                   	leave  
c010475f:	c3                   	ret    

c0104760 <page_init>:

/* pmm_init - initialize the physical memory management */
static void
page_init(void) {
c0104760:	55                   	push   %ebp
c0104761:	89 e5                	mov    %esp,%ebp
c0104763:	57                   	push   %edi
c0104764:	56                   	push   %esi
c0104765:	53                   	push   %ebx
c0104766:	81 ec 9c 00 00 00    	sub    $0x9c,%esp
    struct e820map *memmap = (struct e820map *)(0x8000 + KERNBASE);
c010476c:	c7 45 c4 00 80 00 c0 	movl   $0xc0008000,-0x3c(%ebp)
    uint64_t maxpa = 0;
c0104773:	c7 45 e0 00 00 00 00 	movl   $0x0,-0x20(%ebp)
c010477a:	c7 45 e4 00 00 00 00 	movl   $0x0,-0x1c(%ebp)

    cprintf("e820map:\n");
c0104781:	c7 04 24 a7 98 10 c0 	movl   $0xc01098a7,(%esp)
c0104788:	e8 be bb ff ff       	call   c010034b <cprintf>
    int i;
    for (i = 0; i < memmap->nr_map; i ++) {
c010478d:	c7 45 dc 00 00 00 00 	movl   $0x0,-0x24(%ebp)
c0104794:	e9 15 01 00 00       	jmp    c01048ae <page_init+0x14e>
        uint64_t begin = memmap->map[i].addr, end = begin + memmap->map[i].size;
c0104799:	8b 4d c4             	mov    -0x3c(%ebp),%ecx
c010479c:	8b 55 dc             	mov    -0x24(%ebp),%edx
c010479f:	89 d0                	mov    %edx,%eax
c01047a1:	c1 e0 02             	shl    $0x2,%eax
c01047a4:	01 d0                	add    %edx,%eax
c01047a6:	c1 e0 02             	shl    $0x2,%eax
c01047a9:	01 c8                	add    %ecx,%eax
c01047ab:	8b 50 08             	mov    0x8(%eax),%edx
c01047ae:	8b 40 04             	mov    0x4(%eax),%eax
c01047b1:	89 45 b8             	mov    %eax,-0x48(%ebp)
c01047b4:	89 55 bc             	mov    %edx,-0x44(%ebp)
c01047b7:	8b 4d c4             	mov    -0x3c(%ebp),%ecx
c01047ba:	8b 55 dc             	mov    -0x24(%ebp),%edx
c01047bd:	89 d0                	mov    %edx,%eax
c01047bf:	c1 e0 02             	shl    $0x2,%eax
c01047c2:	01 d0                	add    %edx,%eax
c01047c4:	c1 e0 02             	shl    $0x2,%eax
c01047c7:	01 c8                	add    %ecx,%eax
c01047c9:	8b 48 0c             	mov    0xc(%eax),%ecx
c01047cc:	8b 58 10             	mov    0x10(%eax),%ebx
c01047cf:	8b 45 b8             	mov    -0x48(%ebp),%eax
c01047d2:	8b 55 bc             	mov    -0x44(%ebp),%edx
c01047d5:	01 c8                	add    %ecx,%eax
c01047d7:	11 da                	adc    %ebx,%edx
c01047d9:	89 45 b0             	mov    %eax,-0x50(%ebp)
c01047dc:	89 55 b4             	mov    %edx,-0x4c(%ebp)
        cprintf("  memory: %08llx, [%08llx, %08llx], type = %d.\n",
c01047df:	8b 4d c4             	mov    -0x3c(%ebp),%ecx
c01047e2:	8b 55 dc             	mov    -0x24(%ebp),%edx
c01047e5:	89 d0                	mov    %edx,%eax
c01047e7:	c1 e0 02             	shl    $0x2,%eax
c01047ea:	01 d0                	add    %edx,%eax
c01047ec:	c1 e0 02             	shl    $0x2,%eax
c01047ef:	01 c8                	add    %ecx,%eax
c01047f1:	83 c0 14             	add    $0x14,%eax
c01047f4:	8b 00                	mov    (%eax),%eax
c01047f6:	89 85 7c ff ff ff    	mov    %eax,-0x84(%ebp)
c01047fc:	8b 45 b0             	mov    -0x50(%ebp),%eax
c01047ff:	8b 55 b4             	mov    -0x4c(%ebp),%edx
c0104802:	83 c0 ff             	add    $0xffffffff,%eax
c0104805:	83 d2 ff             	adc    $0xffffffff,%edx
c0104808:	89 c6                	mov    %eax,%esi
c010480a:	89 d7                	mov    %edx,%edi
c010480c:	8b 4d c4             	mov    -0x3c(%ebp),%ecx
c010480f:	8b 55 dc             	mov    -0x24(%ebp),%edx
c0104812:	89 d0                	mov    %edx,%eax
c0104814:	c1 e0 02             	shl    $0x2,%eax
c0104817:	01 d0                	add    %edx,%eax
c0104819:	c1 e0 02             	shl    $0x2,%eax
c010481c:	01 c8                	add    %ecx,%eax
c010481e:	8b 48 0c             	mov    0xc(%eax),%ecx
c0104821:	8b 58 10             	mov    0x10(%eax),%ebx
c0104824:	8b 85 7c ff ff ff    	mov    -0x84(%ebp),%eax
c010482a:	89 44 24 1c          	mov    %eax,0x1c(%esp)
c010482e:	89 74 24 14          	mov    %esi,0x14(%esp)
c0104832:	89 7c 24 18          	mov    %edi,0x18(%esp)
c0104836:	8b 45 b8             	mov    -0x48(%ebp),%eax
c0104839:	8b 55 bc             	mov    -0x44(%ebp),%edx
c010483c:	89 44 24 0c          	mov    %eax,0xc(%esp)
c0104840:	89 54 24 10          	mov    %edx,0x10(%esp)
c0104844:	89 4c 24 04          	mov    %ecx,0x4(%esp)
c0104848:	89 5c 24 08          	mov    %ebx,0x8(%esp)
c010484c:	c7 04 24 b4 98 10 c0 	movl   $0xc01098b4,(%esp)
c0104853:	e8 f3 ba ff ff       	call   c010034b <cprintf>
                memmap->map[i].size, begin, end - 1, memmap->map[i].type);
        if (memmap->map[i].type == E820_ARM) {
c0104858:	8b 4d c4             	mov    -0x3c(%ebp),%ecx
c010485b:	8b 55 dc             	mov    -0x24(%ebp),%edx
c010485e:	89 d0                	mov    %edx,%eax
c0104860:	c1 e0 02             	shl    $0x2,%eax
c0104863:	01 d0                	add    %edx,%eax
c0104865:	c1 e0 02             	shl    $0x2,%eax
c0104868:	01 c8                	add    %ecx,%eax
c010486a:	83 c0 14             	add    $0x14,%eax
c010486d:	8b 00                	mov    (%eax),%eax
c010486f:	83 f8 01             	cmp    $0x1,%eax
c0104872:	75 36                	jne    c01048aa <page_init+0x14a>
            if (maxpa < end && begin < KMEMSIZE) {
c0104874:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0104877:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c010487a:	3b 55 b4             	cmp    -0x4c(%ebp),%edx
c010487d:	77 2b                	ja     c01048aa <page_init+0x14a>
c010487f:	3b 55 b4             	cmp    -0x4c(%ebp),%edx
c0104882:	72 05                	jb     c0104889 <page_init+0x129>
c0104884:	3b 45 b0             	cmp    -0x50(%ebp),%eax
c0104887:	73 21                	jae    c01048aa <page_init+0x14a>
c0104889:	83 7d bc 00          	cmpl   $0x0,-0x44(%ebp)
c010488d:	77 1b                	ja     c01048aa <page_init+0x14a>
c010488f:	83 7d bc 00          	cmpl   $0x0,-0x44(%ebp)
c0104893:	72 09                	jb     c010489e <page_init+0x13e>
c0104895:	81 7d b8 ff ff ff 37 	cmpl   $0x37ffffff,-0x48(%ebp)
c010489c:	77 0c                	ja     c01048aa <page_init+0x14a>
                maxpa = end;
c010489e:	8b 45 b0             	mov    -0x50(%ebp),%eax
c01048a1:	8b 55 b4             	mov    -0x4c(%ebp),%edx
c01048a4:	89 45 e0             	mov    %eax,-0x20(%ebp)
c01048a7:	89 55 e4             	mov    %edx,-0x1c(%ebp)
    struct e820map *memmap = (struct e820map *)(0x8000 + KERNBASE);
    uint64_t maxpa = 0;

    cprintf("e820map:\n");
    int i;
    for (i = 0; i < memmap->nr_map; i ++) {
c01048aa:	83 45 dc 01          	addl   $0x1,-0x24(%ebp)
c01048ae:	8b 45 c4             	mov    -0x3c(%ebp),%eax
c01048b1:	8b 00                	mov    (%eax),%eax
c01048b3:	3b 45 dc             	cmp    -0x24(%ebp),%eax
c01048b6:	0f 8f dd fe ff ff    	jg     c0104799 <page_init+0x39>
            if (maxpa < end && begin < KMEMSIZE) {
                maxpa = end;
            }
        }
    }
    if (maxpa > KMEMSIZE) {
c01048bc:	83 7d e4 00          	cmpl   $0x0,-0x1c(%ebp)
c01048c0:	72 1d                	jb     c01048df <page_init+0x17f>
c01048c2:	83 7d e4 00          	cmpl   $0x0,-0x1c(%ebp)
c01048c6:	77 09                	ja     c01048d1 <page_init+0x171>
c01048c8:	81 7d e0 00 00 00 38 	cmpl   $0x38000000,-0x20(%ebp)
c01048cf:	76 0e                	jbe    c01048df <page_init+0x17f>
        maxpa = KMEMSIZE;
c01048d1:	c7 45 e0 00 00 00 38 	movl   $0x38000000,-0x20(%ebp)
c01048d8:	c7 45 e4 00 00 00 00 	movl   $0x0,-0x1c(%ebp)
    }

    extern char end[];

    npage = maxpa / PGSIZE;
c01048df:	8b 45 e0             	mov    -0x20(%ebp),%eax
c01048e2:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c01048e5:	0f ac d0 0c          	shrd   $0xc,%edx,%eax
c01048e9:	c1 ea 0c             	shr    $0xc,%edx
c01048ec:	a3 20 1a 12 c0       	mov    %eax,0xc0121a20
    pages = (struct Page *)ROUNDUP((void *)end, PGSIZE);
c01048f1:	c7 45 ac 00 10 00 00 	movl   $0x1000,-0x54(%ebp)
c01048f8:	b8 b0 1b 12 c0       	mov    $0xc0121bb0,%eax
c01048fd:	8d 50 ff             	lea    -0x1(%eax),%edx
c0104900:	8b 45 ac             	mov    -0x54(%ebp),%eax
c0104903:	01 d0                	add    %edx,%eax
c0104905:	89 45 a8             	mov    %eax,-0x58(%ebp)
c0104908:	8b 45 a8             	mov    -0x58(%ebp),%eax
c010490b:	ba 00 00 00 00       	mov    $0x0,%edx
c0104910:	f7 75 ac             	divl   -0x54(%ebp)
c0104913:	89 d0                	mov    %edx,%eax
c0104915:	8b 55 a8             	mov    -0x58(%ebp),%edx
c0104918:	29 c2                	sub    %eax,%edx
c010491a:	89 d0                	mov    %edx,%eax
c010491c:	a3 d4 1a 12 c0       	mov    %eax,0xc0121ad4

    for (i = 0; i < npage; i ++) {
c0104921:	c7 45 dc 00 00 00 00 	movl   $0x0,-0x24(%ebp)
c0104928:	eb 27                	jmp    c0104951 <page_init+0x1f1>
        SetPageReserved(pages + i);
c010492a:	a1 d4 1a 12 c0       	mov    0xc0121ad4,%eax
c010492f:	8b 55 dc             	mov    -0x24(%ebp),%edx
c0104932:	c1 e2 05             	shl    $0x5,%edx
c0104935:	01 d0                	add    %edx,%eax
c0104937:	83 c0 04             	add    $0x4,%eax
c010493a:	c7 45 90 00 00 00 00 	movl   $0x0,-0x70(%ebp)
c0104941:	89 45 8c             	mov    %eax,-0x74(%ebp)
 * Note that @nr may be almost arbitrarily large; this function is not
 * restricted to acting on a single-word quantity.
 * */
static inline void
set_bit(int nr, volatile void *addr) {
    asm volatile ("btsl %1, %0" :"=m" (*(volatile long *)addr) : "Ir" (nr));
c0104944:	8b 45 8c             	mov    -0x74(%ebp),%eax
c0104947:	8b 55 90             	mov    -0x70(%ebp),%edx
c010494a:	0f ab 10             	bts    %edx,(%eax)
    extern char end[];

    npage = maxpa / PGSIZE;
    pages = (struct Page *)ROUNDUP((void *)end, PGSIZE);

    for (i = 0; i < npage; i ++) {
c010494d:	83 45 dc 01          	addl   $0x1,-0x24(%ebp)
c0104951:	8b 55 dc             	mov    -0x24(%ebp),%edx
c0104954:	a1 20 1a 12 c0       	mov    0xc0121a20,%eax
c0104959:	39 c2                	cmp    %eax,%edx
c010495b:	72 cd                	jb     c010492a <page_init+0x1ca>
        SetPageReserved(pages + i);
    }

    uintptr_t freemem = PADDR((uintptr_t)pages + sizeof(struct Page) * npage);
c010495d:	a1 20 1a 12 c0       	mov    0xc0121a20,%eax
c0104962:	c1 e0 05             	shl    $0x5,%eax
c0104965:	89 c2                	mov    %eax,%edx
c0104967:	a1 d4 1a 12 c0       	mov    0xc0121ad4,%eax
c010496c:	01 d0                	add    %edx,%eax
c010496e:	89 45 a4             	mov    %eax,-0x5c(%ebp)
c0104971:	81 7d a4 ff ff ff bf 	cmpl   $0xbfffffff,-0x5c(%ebp)
c0104978:	77 23                	ja     c010499d <page_init+0x23d>
c010497a:	8b 45 a4             	mov    -0x5c(%ebp),%eax
c010497d:	89 44 24 0c          	mov    %eax,0xc(%esp)
c0104981:	c7 44 24 08 40 98 10 	movl   $0xc0109840,0x8(%esp)
c0104988:	c0 
c0104989:	c7 44 24 04 e8 00 00 	movl   $0xe8,0x4(%esp)
c0104990:	00 
c0104991:	c7 04 24 e4 98 10 c0 	movl   $0xc01098e4,(%esp)
c0104998:	e8 38 c3 ff ff       	call   c0100cd5 <__panic>
c010499d:	8b 45 a4             	mov    -0x5c(%ebp),%eax
c01049a0:	05 00 00 00 40       	add    $0x40000000,%eax
c01049a5:	89 45 a0             	mov    %eax,-0x60(%ebp)

    for (i = 0; i < memmap->nr_map; i ++) {
c01049a8:	c7 45 dc 00 00 00 00 	movl   $0x0,-0x24(%ebp)
c01049af:	e9 74 01 00 00       	jmp    c0104b28 <page_init+0x3c8>
        uint64_t begin = memmap->map[i].addr, end = begin + memmap->map[i].size;
c01049b4:	8b 4d c4             	mov    -0x3c(%ebp),%ecx
c01049b7:	8b 55 dc             	mov    -0x24(%ebp),%edx
c01049ba:	89 d0                	mov    %edx,%eax
c01049bc:	c1 e0 02             	shl    $0x2,%eax
c01049bf:	01 d0                	add    %edx,%eax
c01049c1:	c1 e0 02             	shl    $0x2,%eax
c01049c4:	01 c8                	add    %ecx,%eax
c01049c6:	8b 50 08             	mov    0x8(%eax),%edx
c01049c9:	8b 40 04             	mov    0x4(%eax),%eax
c01049cc:	89 45 d0             	mov    %eax,-0x30(%ebp)
c01049cf:	89 55 d4             	mov    %edx,-0x2c(%ebp)
c01049d2:	8b 4d c4             	mov    -0x3c(%ebp),%ecx
c01049d5:	8b 55 dc             	mov    -0x24(%ebp),%edx
c01049d8:	89 d0                	mov    %edx,%eax
c01049da:	c1 e0 02             	shl    $0x2,%eax
c01049dd:	01 d0                	add    %edx,%eax
c01049df:	c1 e0 02             	shl    $0x2,%eax
c01049e2:	01 c8                	add    %ecx,%eax
c01049e4:	8b 48 0c             	mov    0xc(%eax),%ecx
c01049e7:	8b 58 10             	mov    0x10(%eax),%ebx
c01049ea:	8b 45 d0             	mov    -0x30(%ebp),%eax
c01049ed:	8b 55 d4             	mov    -0x2c(%ebp),%edx
c01049f0:	01 c8                	add    %ecx,%eax
c01049f2:	11 da                	adc    %ebx,%edx
c01049f4:	89 45 c8             	mov    %eax,-0x38(%ebp)
c01049f7:	89 55 cc             	mov    %edx,-0x34(%ebp)
        if (memmap->map[i].type == E820_ARM) {
c01049fa:	8b 4d c4             	mov    -0x3c(%ebp),%ecx
c01049fd:	8b 55 dc             	mov    -0x24(%ebp),%edx
c0104a00:	89 d0                	mov    %edx,%eax
c0104a02:	c1 e0 02             	shl    $0x2,%eax
c0104a05:	01 d0                	add    %edx,%eax
c0104a07:	c1 e0 02             	shl    $0x2,%eax
c0104a0a:	01 c8                	add    %ecx,%eax
c0104a0c:	83 c0 14             	add    $0x14,%eax
c0104a0f:	8b 00                	mov    (%eax),%eax
c0104a11:	83 f8 01             	cmp    $0x1,%eax
c0104a14:	0f 85 0a 01 00 00    	jne    c0104b24 <page_init+0x3c4>
            if (begin < freemem) {
c0104a1a:	8b 45 a0             	mov    -0x60(%ebp),%eax
c0104a1d:	ba 00 00 00 00       	mov    $0x0,%edx
c0104a22:	3b 55 d4             	cmp    -0x2c(%ebp),%edx
c0104a25:	72 17                	jb     c0104a3e <page_init+0x2de>
c0104a27:	3b 55 d4             	cmp    -0x2c(%ebp),%edx
c0104a2a:	77 05                	ja     c0104a31 <page_init+0x2d1>
c0104a2c:	3b 45 d0             	cmp    -0x30(%ebp),%eax
c0104a2f:	76 0d                	jbe    c0104a3e <page_init+0x2de>
                begin = freemem;
c0104a31:	8b 45 a0             	mov    -0x60(%ebp),%eax
c0104a34:	89 45 d0             	mov    %eax,-0x30(%ebp)
c0104a37:	c7 45 d4 00 00 00 00 	movl   $0x0,-0x2c(%ebp)
            }
            if (end > KMEMSIZE) {
c0104a3e:	83 7d cc 00          	cmpl   $0x0,-0x34(%ebp)
c0104a42:	72 1d                	jb     c0104a61 <page_init+0x301>
c0104a44:	83 7d cc 00          	cmpl   $0x0,-0x34(%ebp)
c0104a48:	77 09                	ja     c0104a53 <page_init+0x2f3>
c0104a4a:	81 7d c8 00 00 00 38 	cmpl   $0x38000000,-0x38(%ebp)
c0104a51:	76 0e                	jbe    c0104a61 <page_init+0x301>
                end = KMEMSIZE;
c0104a53:	c7 45 c8 00 00 00 38 	movl   $0x38000000,-0x38(%ebp)
c0104a5a:	c7 45 cc 00 00 00 00 	movl   $0x0,-0x34(%ebp)
            }
            if (begin < end) {
c0104a61:	8b 45 d0             	mov    -0x30(%ebp),%eax
c0104a64:	8b 55 d4             	mov    -0x2c(%ebp),%edx
c0104a67:	3b 55 cc             	cmp    -0x34(%ebp),%edx
c0104a6a:	0f 87 b4 00 00 00    	ja     c0104b24 <page_init+0x3c4>
c0104a70:	3b 55 cc             	cmp    -0x34(%ebp),%edx
c0104a73:	72 09                	jb     c0104a7e <page_init+0x31e>
c0104a75:	3b 45 c8             	cmp    -0x38(%ebp),%eax
c0104a78:	0f 83 a6 00 00 00    	jae    c0104b24 <page_init+0x3c4>
                begin = ROUNDUP(begin, PGSIZE);
c0104a7e:	c7 45 9c 00 10 00 00 	movl   $0x1000,-0x64(%ebp)
c0104a85:	8b 55 d0             	mov    -0x30(%ebp),%edx
c0104a88:	8b 45 9c             	mov    -0x64(%ebp),%eax
c0104a8b:	01 d0                	add    %edx,%eax
c0104a8d:	83 e8 01             	sub    $0x1,%eax
c0104a90:	89 45 98             	mov    %eax,-0x68(%ebp)
c0104a93:	8b 45 98             	mov    -0x68(%ebp),%eax
c0104a96:	ba 00 00 00 00       	mov    $0x0,%edx
c0104a9b:	f7 75 9c             	divl   -0x64(%ebp)
c0104a9e:	89 d0                	mov    %edx,%eax
c0104aa0:	8b 55 98             	mov    -0x68(%ebp),%edx
c0104aa3:	29 c2                	sub    %eax,%edx
c0104aa5:	89 d0                	mov    %edx,%eax
c0104aa7:	ba 00 00 00 00       	mov    $0x0,%edx
c0104aac:	89 45 d0             	mov    %eax,-0x30(%ebp)
c0104aaf:	89 55 d4             	mov    %edx,-0x2c(%ebp)
                end = ROUNDDOWN(end, PGSIZE);
c0104ab2:	8b 45 c8             	mov    -0x38(%ebp),%eax
c0104ab5:	89 45 94             	mov    %eax,-0x6c(%ebp)
c0104ab8:	8b 45 94             	mov    -0x6c(%ebp),%eax
c0104abb:	ba 00 00 00 00       	mov    $0x0,%edx
c0104ac0:	89 c7                	mov    %eax,%edi
c0104ac2:	81 e7 00 f0 ff ff    	and    $0xfffff000,%edi
c0104ac8:	89 7d 80             	mov    %edi,-0x80(%ebp)
c0104acb:	89 d0                	mov    %edx,%eax
c0104acd:	83 e0 00             	and    $0x0,%eax
c0104ad0:	89 45 84             	mov    %eax,-0x7c(%ebp)
c0104ad3:	8b 45 80             	mov    -0x80(%ebp),%eax
c0104ad6:	8b 55 84             	mov    -0x7c(%ebp),%edx
c0104ad9:	89 45 c8             	mov    %eax,-0x38(%ebp)
c0104adc:	89 55 cc             	mov    %edx,-0x34(%ebp)
                if (begin < end) {
c0104adf:	8b 45 d0             	mov    -0x30(%ebp),%eax
c0104ae2:	8b 55 d4             	mov    -0x2c(%ebp),%edx
c0104ae5:	3b 55 cc             	cmp    -0x34(%ebp),%edx
c0104ae8:	77 3a                	ja     c0104b24 <page_init+0x3c4>
c0104aea:	3b 55 cc             	cmp    -0x34(%ebp),%edx
c0104aed:	72 05                	jb     c0104af4 <page_init+0x394>
c0104aef:	3b 45 c8             	cmp    -0x38(%ebp),%eax
c0104af2:	73 30                	jae    c0104b24 <page_init+0x3c4>
                    init_memmap(pa2page(begin), (end - begin) / PGSIZE);
c0104af4:	8b 4d d0             	mov    -0x30(%ebp),%ecx
c0104af7:	8b 5d d4             	mov    -0x2c(%ebp),%ebx
c0104afa:	8b 45 c8             	mov    -0x38(%ebp),%eax
c0104afd:	8b 55 cc             	mov    -0x34(%ebp),%edx
c0104b00:	29 c8                	sub    %ecx,%eax
c0104b02:	19 da                	sbb    %ebx,%edx
c0104b04:	0f ac d0 0c          	shrd   $0xc,%edx,%eax
c0104b08:	c1 ea 0c             	shr    $0xc,%edx
c0104b0b:	89 c3                	mov    %eax,%ebx
c0104b0d:	8b 45 d0             	mov    -0x30(%ebp),%eax
c0104b10:	89 04 24             	mov    %eax,(%esp)
c0104b13:	e8 5a f8 ff ff       	call   c0104372 <pa2page>
c0104b18:	89 5c 24 04          	mov    %ebx,0x4(%esp)
c0104b1c:	89 04 24             	mov    %eax,(%esp)
c0104b1f:	e8 55 fb ff ff       	call   c0104679 <init_memmap>
        SetPageReserved(pages + i);
    }

    uintptr_t freemem = PADDR((uintptr_t)pages + sizeof(struct Page) * npage);

    for (i = 0; i < memmap->nr_map; i ++) {
c0104b24:	83 45 dc 01          	addl   $0x1,-0x24(%ebp)
c0104b28:	8b 45 c4             	mov    -0x3c(%ebp),%eax
c0104b2b:	8b 00                	mov    (%eax),%eax
c0104b2d:	3b 45 dc             	cmp    -0x24(%ebp),%eax
c0104b30:	0f 8f 7e fe ff ff    	jg     c01049b4 <page_init+0x254>
                    init_memmap(pa2page(begin), (end - begin) / PGSIZE);
                }
            }
        }
    }
}
c0104b36:	81 c4 9c 00 00 00    	add    $0x9c,%esp
c0104b3c:	5b                   	pop    %ebx
c0104b3d:	5e                   	pop    %esi
c0104b3e:	5f                   	pop    %edi
c0104b3f:	5d                   	pop    %ebp
c0104b40:	c3                   	ret    

c0104b41 <enable_paging>:

static void
enable_paging(void) {
c0104b41:	55                   	push   %ebp
c0104b42:	89 e5                	mov    %esp,%ebp
c0104b44:	83 ec 10             	sub    $0x10,%esp
    lcr3(boot_cr3);
c0104b47:	a1 d0 1a 12 c0       	mov    0xc0121ad0,%eax
c0104b4c:	89 45 f8             	mov    %eax,-0x8(%ebp)
    asm volatile ("mov %0, %%cr0" :: "r" (cr0) : "memory");
}

static inline void
lcr3(uintptr_t cr3) {
    asm volatile ("mov %0, %%cr3" :: "r" (cr3) : "memory");
c0104b4f:	8b 45 f8             	mov    -0x8(%ebp),%eax
c0104b52:	0f 22 d8             	mov    %eax,%cr3
}

static inline uintptr_t
rcr0(void) {
    uintptr_t cr0;
    asm volatile ("mov %%cr0, %0" : "=r" (cr0) :: "memory");
c0104b55:	0f 20 c0             	mov    %cr0,%eax
c0104b58:	89 45 f4             	mov    %eax,-0xc(%ebp)
    return cr0;
c0104b5b:	8b 45 f4             	mov    -0xc(%ebp),%eax

    // turn on paging
    uint32_t cr0 = rcr0();
c0104b5e:	89 45 fc             	mov    %eax,-0x4(%ebp)
    cr0 |= CR0_PE | CR0_PG | CR0_AM | CR0_WP | CR0_NE | CR0_TS | CR0_EM | CR0_MP;
c0104b61:	81 4d fc 2f 00 05 80 	orl    $0x8005002f,-0x4(%ebp)
    cr0 &= ~(CR0_TS | CR0_EM);
c0104b68:	83 65 fc f3          	andl   $0xfffffff3,-0x4(%ebp)
c0104b6c:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0104b6f:	89 45 f0             	mov    %eax,-0x10(%ebp)
    asm volatile ("pushl %0; popfl" :: "r" (eflags));
}

static inline void
lcr0(uintptr_t cr0) {
    asm volatile ("mov %0, %%cr0" :: "r" (cr0) : "memory");
c0104b72:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0104b75:	0f 22 c0             	mov    %eax,%cr0
    lcr0(cr0);
}
c0104b78:	c9                   	leave  
c0104b79:	c3                   	ret    

c0104b7a <boot_map_segment>:
//  la:   linear address of this memory need to map (after x86 segment map)
//  size: memory size
//  pa:   physical address of this memory
//  perm: permission of this memory  
static void
boot_map_segment(pde_t *pgdir, uintptr_t la, size_t size, uintptr_t pa, uint32_t perm) {
c0104b7a:	55                   	push   %ebp
c0104b7b:	89 e5                	mov    %esp,%ebp
c0104b7d:	83 ec 38             	sub    $0x38,%esp
    assert(PGOFF(la) == PGOFF(pa));
c0104b80:	8b 45 14             	mov    0x14(%ebp),%eax
c0104b83:	8b 55 0c             	mov    0xc(%ebp),%edx
c0104b86:	31 d0                	xor    %edx,%eax
c0104b88:	25 ff 0f 00 00       	and    $0xfff,%eax
c0104b8d:	85 c0                	test   %eax,%eax
c0104b8f:	74 24                	je     c0104bb5 <boot_map_segment+0x3b>
c0104b91:	c7 44 24 0c f2 98 10 	movl   $0xc01098f2,0xc(%esp)
c0104b98:	c0 
c0104b99:	c7 44 24 08 09 99 10 	movl   $0xc0109909,0x8(%esp)
c0104ba0:	c0 
c0104ba1:	c7 44 24 04 11 01 00 	movl   $0x111,0x4(%esp)
c0104ba8:	00 
c0104ba9:	c7 04 24 e4 98 10 c0 	movl   $0xc01098e4,(%esp)
c0104bb0:	e8 20 c1 ff ff       	call   c0100cd5 <__panic>
    size_t n = ROUNDUP(size + PGOFF(la), PGSIZE) / PGSIZE;
c0104bb5:	c7 45 f0 00 10 00 00 	movl   $0x1000,-0x10(%ebp)
c0104bbc:	8b 45 0c             	mov    0xc(%ebp),%eax
c0104bbf:	25 ff 0f 00 00       	and    $0xfff,%eax
c0104bc4:	89 c2                	mov    %eax,%edx
c0104bc6:	8b 45 10             	mov    0x10(%ebp),%eax
c0104bc9:	01 c2                	add    %eax,%edx
c0104bcb:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0104bce:	01 d0                	add    %edx,%eax
c0104bd0:	83 e8 01             	sub    $0x1,%eax
c0104bd3:	89 45 ec             	mov    %eax,-0x14(%ebp)
c0104bd6:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0104bd9:	ba 00 00 00 00       	mov    $0x0,%edx
c0104bde:	f7 75 f0             	divl   -0x10(%ebp)
c0104be1:	89 d0                	mov    %edx,%eax
c0104be3:	8b 55 ec             	mov    -0x14(%ebp),%edx
c0104be6:	29 c2                	sub    %eax,%edx
c0104be8:	89 d0                	mov    %edx,%eax
c0104bea:	c1 e8 0c             	shr    $0xc,%eax
c0104bed:	89 45 f4             	mov    %eax,-0xc(%ebp)
    la = ROUNDDOWN(la, PGSIZE);
c0104bf0:	8b 45 0c             	mov    0xc(%ebp),%eax
c0104bf3:	89 45 e8             	mov    %eax,-0x18(%ebp)
c0104bf6:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0104bf9:	25 00 f0 ff ff       	and    $0xfffff000,%eax
c0104bfe:	89 45 0c             	mov    %eax,0xc(%ebp)
    pa = ROUNDDOWN(pa, PGSIZE);
c0104c01:	8b 45 14             	mov    0x14(%ebp),%eax
c0104c04:	89 45 e4             	mov    %eax,-0x1c(%ebp)
c0104c07:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0104c0a:	25 00 f0 ff ff       	and    $0xfffff000,%eax
c0104c0f:	89 45 14             	mov    %eax,0x14(%ebp)
    for (; n > 0; n --, la += PGSIZE, pa += PGSIZE) {
c0104c12:	eb 6b                	jmp    c0104c7f <boot_map_segment+0x105>
        pte_t *ptep = get_pte(pgdir, la, 1);
c0104c14:	c7 44 24 08 01 00 00 	movl   $0x1,0x8(%esp)
c0104c1b:	00 
c0104c1c:	8b 45 0c             	mov    0xc(%ebp),%eax
c0104c1f:	89 44 24 04          	mov    %eax,0x4(%esp)
c0104c23:	8b 45 08             	mov    0x8(%ebp),%eax
c0104c26:	89 04 24             	mov    %eax,(%esp)
c0104c29:	e8 cc 01 00 00       	call   c0104dfa <get_pte>
c0104c2e:	89 45 e0             	mov    %eax,-0x20(%ebp)
        assert(ptep != NULL);
c0104c31:	83 7d e0 00          	cmpl   $0x0,-0x20(%ebp)
c0104c35:	75 24                	jne    c0104c5b <boot_map_segment+0xe1>
c0104c37:	c7 44 24 0c 1e 99 10 	movl   $0xc010991e,0xc(%esp)
c0104c3e:	c0 
c0104c3f:	c7 44 24 08 09 99 10 	movl   $0xc0109909,0x8(%esp)
c0104c46:	c0 
c0104c47:	c7 44 24 04 17 01 00 	movl   $0x117,0x4(%esp)
c0104c4e:	00 
c0104c4f:	c7 04 24 e4 98 10 c0 	movl   $0xc01098e4,(%esp)
c0104c56:	e8 7a c0 ff ff       	call   c0100cd5 <__panic>
        *ptep = pa | PTE_P | perm;
c0104c5b:	8b 45 18             	mov    0x18(%ebp),%eax
c0104c5e:	8b 55 14             	mov    0x14(%ebp),%edx
c0104c61:	09 d0                	or     %edx,%eax
c0104c63:	83 c8 01             	or     $0x1,%eax
c0104c66:	89 c2                	mov    %eax,%edx
c0104c68:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0104c6b:	89 10                	mov    %edx,(%eax)
boot_map_segment(pde_t *pgdir, uintptr_t la, size_t size, uintptr_t pa, uint32_t perm) {
    assert(PGOFF(la) == PGOFF(pa));
    size_t n = ROUNDUP(size + PGOFF(la), PGSIZE) / PGSIZE;
    la = ROUNDDOWN(la, PGSIZE);
    pa = ROUNDDOWN(pa, PGSIZE);
    for (; n > 0; n --, la += PGSIZE, pa += PGSIZE) {
c0104c6d:	83 6d f4 01          	subl   $0x1,-0xc(%ebp)
c0104c71:	81 45 0c 00 10 00 00 	addl   $0x1000,0xc(%ebp)
c0104c78:	81 45 14 00 10 00 00 	addl   $0x1000,0x14(%ebp)
c0104c7f:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0104c83:	75 8f                	jne    c0104c14 <boot_map_segment+0x9a>
        pte_t *ptep = get_pte(pgdir, la, 1);
        assert(ptep != NULL);
        *ptep = pa | PTE_P | perm;
    }
}
c0104c85:	c9                   	leave  
c0104c86:	c3                   	ret    

c0104c87 <boot_alloc_page>:

//boot_alloc_page - allocate one page using pmm->alloc_pages(1) 
// return value: the kernel virtual address of this allocated page
//note: this function is used to get the memory for PDT(Page Directory Table)&PT(Page Table)
static void *
boot_alloc_page(void) {
c0104c87:	55                   	push   %ebp
c0104c88:	89 e5                	mov    %esp,%ebp
c0104c8a:	83 ec 28             	sub    $0x28,%esp
    struct Page *p = alloc_page();
c0104c8d:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0104c94:	e8 ff f9 ff ff       	call   c0104698 <alloc_pages>
c0104c99:	89 45 f4             	mov    %eax,-0xc(%ebp)
    if (p == NULL) {
c0104c9c:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0104ca0:	75 1c                	jne    c0104cbe <boot_alloc_page+0x37>
        panic("boot_alloc_page failed.\n");
c0104ca2:	c7 44 24 08 2b 99 10 	movl   $0xc010992b,0x8(%esp)
c0104ca9:	c0 
c0104caa:	c7 44 24 04 23 01 00 	movl   $0x123,0x4(%esp)
c0104cb1:	00 
c0104cb2:	c7 04 24 e4 98 10 c0 	movl   $0xc01098e4,(%esp)
c0104cb9:	e8 17 c0 ff ff       	call   c0100cd5 <__panic>
    }
    return page2kva(p);
c0104cbe:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0104cc1:	89 04 24             	mov    %eax,(%esp)
c0104cc4:	e8 ee f6 ff ff       	call   c01043b7 <page2kva>
}
c0104cc9:	c9                   	leave  
c0104cca:	c3                   	ret    

c0104ccb <pmm_init>:

//pmm_init - setup a pmm to manage physical memory, build PDT&PT to setup paging mechanism 
//         - check the correctness of pmm & paging mechanism, print PDT&PT
void
pmm_init(void) {
c0104ccb:	55                   	push   %ebp
c0104ccc:	89 e5                	mov    %esp,%ebp
c0104cce:	83 ec 38             	sub    $0x38,%esp
    //We need to alloc/free the physical memory (granularity is 4KB or other size). 
    //So a framework of physical memory manager (struct pmm_manager)is defined in pmm.h
    //First we should init a physical memory manager(pmm) based on the framework.
    //Then pmm can alloc/free the physical memory. 
    //Now the first_fit/best_fit/worst_fit/buddy_system pmm are available.
    init_pmm_manager();
c0104cd1:	e8 70 f9 ff ff       	call   c0104646 <init_pmm_manager>

    // detect physical memory space, reserve already used memory,
    // then use pmm->init_memmap to create free page list
    page_init();
c0104cd6:	e8 85 fa ff ff       	call   c0104760 <page_init>

    //use pmm->check to verify the correctness of the alloc/free function in a pmm
    check_alloc_page();
c0104cdb:	e8 31 05 00 00       	call   c0105211 <check_alloc_page>

    // create boot_pgdir, an initial page directory(Page Directory Table, PDT)
    boot_pgdir = boot_alloc_page();
c0104ce0:	e8 a2 ff ff ff       	call   c0104c87 <boot_alloc_page>
c0104ce5:	a3 24 1a 12 c0       	mov    %eax,0xc0121a24
    memset(boot_pgdir, 0, PGSIZE);
c0104cea:	a1 24 1a 12 c0       	mov    0xc0121a24,%eax
c0104cef:	c7 44 24 08 00 10 00 	movl   $0x1000,0x8(%esp)
c0104cf6:	00 
c0104cf7:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c0104cfe:	00 
c0104cff:	89 04 24             	mov    %eax,(%esp)
c0104d02:	e8 58 3d 00 00       	call   c0108a5f <memset>
    boot_cr3 = PADDR(boot_pgdir);
c0104d07:	a1 24 1a 12 c0       	mov    0xc0121a24,%eax
c0104d0c:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0104d0f:	81 7d f4 ff ff ff bf 	cmpl   $0xbfffffff,-0xc(%ebp)
c0104d16:	77 23                	ja     c0104d3b <pmm_init+0x70>
c0104d18:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0104d1b:	89 44 24 0c          	mov    %eax,0xc(%esp)
c0104d1f:	c7 44 24 08 40 98 10 	movl   $0xc0109840,0x8(%esp)
c0104d26:	c0 
c0104d27:	c7 44 24 04 3d 01 00 	movl   $0x13d,0x4(%esp)
c0104d2e:	00 
c0104d2f:	c7 04 24 e4 98 10 c0 	movl   $0xc01098e4,(%esp)
c0104d36:	e8 9a bf ff ff       	call   c0100cd5 <__panic>
c0104d3b:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0104d3e:	05 00 00 00 40       	add    $0x40000000,%eax
c0104d43:	a3 d0 1a 12 c0       	mov    %eax,0xc0121ad0

    check_pgdir();
c0104d48:	e8 e2 04 00 00       	call   c010522f <check_pgdir>

    static_assert(KERNBASE % PTSIZE == 0 && KERNTOP % PTSIZE == 0);

    // recursively insert boot_pgdir in itself
    // to form a virtual page table at virtual address VPT
    boot_pgdir[PDX(VPT)] = PADDR(boot_pgdir) | PTE_P | PTE_W;
c0104d4d:	a1 24 1a 12 c0       	mov    0xc0121a24,%eax
c0104d52:	8d 90 ac 0f 00 00    	lea    0xfac(%eax),%edx
c0104d58:	a1 24 1a 12 c0       	mov    0xc0121a24,%eax
c0104d5d:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0104d60:	81 7d f0 ff ff ff bf 	cmpl   $0xbfffffff,-0x10(%ebp)
c0104d67:	77 23                	ja     c0104d8c <pmm_init+0xc1>
c0104d69:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0104d6c:	89 44 24 0c          	mov    %eax,0xc(%esp)
c0104d70:	c7 44 24 08 40 98 10 	movl   $0xc0109840,0x8(%esp)
c0104d77:	c0 
c0104d78:	c7 44 24 04 45 01 00 	movl   $0x145,0x4(%esp)
c0104d7f:	00 
c0104d80:	c7 04 24 e4 98 10 c0 	movl   $0xc01098e4,(%esp)
c0104d87:	e8 49 bf ff ff       	call   c0100cd5 <__panic>
c0104d8c:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0104d8f:	05 00 00 00 40       	add    $0x40000000,%eax
c0104d94:	83 c8 03             	or     $0x3,%eax
c0104d97:	89 02                	mov    %eax,(%edx)

    // map all physical memory to linear memory with base linear addr KERNBASE
    //linear_addr KERNBASE~KERNBASE+KMEMSIZE = phy_addr 0~KMEMSIZE
    //But shouldn't use this map until enable_paging() & gdt_init() finished.
    boot_map_segment(boot_pgdir, KERNBASE, KMEMSIZE, 0, PTE_W);
c0104d99:	a1 24 1a 12 c0       	mov    0xc0121a24,%eax
c0104d9e:	c7 44 24 10 02 00 00 	movl   $0x2,0x10(%esp)
c0104da5:	00 
c0104da6:	c7 44 24 0c 00 00 00 	movl   $0x0,0xc(%esp)
c0104dad:	00 
c0104dae:	c7 44 24 08 00 00 00 	movl   $0x38000000,0x8(%esp)
c0104db5:	38 
c0104db6:	c7 44 24 04 00 00 00 	movl   $0xc0000000,0x4(%esp)
c0104dbd:	c0 
c0104dbe:	89 04 24             	mov    %eax,(%esp)
c0104dc1:	e8 b4 fd ff ff       	call   c0104b7a <boot_map_segment>

    //temporary map: 
    //virtual_addr 3G~3G+4M = linear_addr 0~4M = linear_addr 3G~3G+4M = phy_addr 0~4M     
    boot_pgdir[0] = boot_pgdir[PDX(KERNBASE)];
c0104dc6:	a1 24 1a 12 c0       	mov    0xc0121a24,%eax
c0104dcb:	8b 15 24 1a 12 c0    	mov    0xc0121a24,%edx
c0104dd1:	8b 92 00 0c 00 00    	mov    0xc00(%edx),%edx
c0104dd7:	89 10                	mov    %edx,(%eax)

    enable_paging();
c0104dd9:	e8 63 fd ff ff       	call   c0104b41 <enable_paging>

    //reload gdt(third time,the last time) to map all physical memory
    //virtual_addr 0~4G=liear_addr 0~4G
    //then set kernel stack(ss:esp) in TSS, setup TSS in gdt, load TSS
    gdt_init();
c0104dde:	e8 74 f7 ff ff       	call   c0104557 <gdt_init>

    //disable the map of virtual_addr 0~4M
    boot_pgdir[0] = 0;
c0104de3:	a1 24 1a 12 c0       	mov    0xc0121a24,%eax
c0104de8:	c7 00 00 00 00 00    	movl   $0x0,(%eax)

    //now the basic virtual memory map(see memalyout.h) is established.
    //check the correctness of the basic virtual memory map.
    check_boot_pgdir();
c0104dee:	e8 d7 0a 00 00       	call   c01058ca <check_boot_pgdir>

    print_pgdir();
c0104df3:	e8 64 0f 00 00       	call   c0105d5c <print_pgdir>

}
c0104df8:	c9                   	leave  
c0104df9:	c3                   	ret    

c0104dfa <get_pte>:
//  pgdir:  the kernel virtual base address of PDT
//  la:     the linear address need to map
//  create: a logical value to decide if alloc a page for PT
// return vaule: the kernel virtual address of this pte
pte_t *
get_pte(pde_t *pgdir, uintptr_t la, bool create) {
c0104dfa:	55                   	push   %ebp
c0104dfb:	89 e5                	mov    %esp,%ebp
c0104dfd:	83 ec 38             	sub    $0x38,%esp
                          // (6) clear page content using memset
                          // (7) set page directory entry's permission
    }
    return NULL;          // (8) return page table entry
#endif
    pde_t *pdep = &pgdir[PDX(la)];
c0104e00:	8b 45 0c             	mov    0xc(%ebp),%eax
c0104e03:	c1 e8 16             	shr    $0x16,%eax
c0104e06:	8d 14 85 00 00 00 00 	lea    0x0(,%eax,4),%edx
c0104e0d:	8b 45 08             	mov    0x8(%ebp),%eax
c0104e10:	01 d0                	add    %edx,%eax
c0104e12:	89 45 f4             	mov    %eax,-0xc(%ebp)
    if (!(*pdep & PTE_P)) {
c0104e15:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0104e18:	8b 00                	mov    (%eax),%eax
c0104e1a:	83 e0 01             	and    $0x1,%eax
c0104e1d:	85 c0                	test   %eax,%eax
c0104e1f:	0f 85 af 00 00 00    	jne    c0104ed4 <get_pte+0xda>
        struct Page *page;
        if (!create || (page = alloc_page()) == NULL) {
c0104e25:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
c0104e29:	74 15                	je     c0104e40 <get_pte+0x46>
c0104e2b:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0104e32:	e8 61 f8 ff ff       	call   c0104698 <alloc_pages>
c0104e37:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0104e3a:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c0104e3e:	75 0a                	jne    c0104e4a <get_pte+0x50>
            return NULL;
c0104e40:	b8 00 00 00 00       	mov    $0x0,%eax
c0104e45:	e9 e6 00 00 00       	jmp    c0104f30 <get_pte+0x136>
        }
        set_page_ref(page, 1);
c0104e4a:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c0104e51:	00 
c0104e52:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0104e55:	89 04 24             	mov    %eax,(%esp)
c0104e58:	e8 40 f6 ff ff       	call   c010449d <set_page_ref>
        uintptr_t pa = page2pa(page);
c0104e5d:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0104e60:	89 04 24             	mov    %eax,(%esp)
c0104e63:	e8 f4 f4 ff ff       	call   c010435c <page2pa>
c0104e68:	89 45 ec             	mov    %eax,-0x14(%ebp)
        memset(KADDR(pa), 0, PGSIZE);
c0104e6b:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0104e6e:	89 45 e8             	mov    %eax,-0x18(%ebp)
c0104e71:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0104e74:	c1 e8 0c             	shr    $0xc,%eax
c0104e77:	89 45 e4             	mov    %eax,-0x1c(%ebp)
c0104e7a:	a1 20 1a 12 c0       	mov    0xc0121a20,%eax
c0104e7f:	39 45 e4             	cmp    %eax,-0x1c(%ebp)
c0104e82:	72 23                	jb     c0104ea7 <get_pte+0xad>
c0104e84:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0104e87:	89 44 24 0c          	mov    %eax,0xc(%esp)
c0104e8b:	c7 44 24 08 1c 98 10 	movl   $0xc010981c,0x8(%esp)
c0104e92:	c0 
c0104e93:	c7 44 24 04 94 01 00 	movl   $0x194,0x4(%esp)
c0104e9a:	00 
c0104e9b:	c7 04 24 e4 98 10 c0 	movl   $0xc01098e4,(%esp)
c0104ea2:	e8 2e be ff ff       	call   c0100cd5 <__panic>
c0104ea7:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0104eaa:	2d 00 00 00 40       	sub    $0x40000000,%eax
c0104eaf:	c7 44 24 08 00 10 00 	movl   $0x1000,0x8(%esp)
c0104eb6:	00 
c0104eb7:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c0104ebe:	00 
c0104ebf:	89 04 24             	mov    %eax,(%esp)
c0104ec2:	e8 98 3b 00 00       	call   c0108a5f <memset>
        *pdep = pa | PTE_U | PTE_W | PTE_P;
c0104ec7:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0104eca:	83 c8 07             	or     $0x7,%eax
c0104ecd:	89 c2                	mov    %eax,%edx
c0104ecf:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0104ed2:	89 10                	mov    %edx,(%eax)
    }
    return &((pte_t *)KADDR(PDE_ADDR(*pdep)))[PTX(la)];
c0104ed4:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0104ed7:	8b 00                	mov    (%eax),%eax
c0104ed9:	25 00 f0 ff ff       	and    $0xfffff000,%eax
c0104ede:	89 45 e0             	mov    %eax,-0x20(%ebp)
c0104ee1:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0104ee4:	c1 e8 0c             	shr    $0xc,%eax
c0104ee7:	89 45 dc             	mov    %eax,-0x24(%ebp)
c0104eea:	a1 20 1a 12 c0       	mov    0xc0121a20,%eax
c0104eef:	39 45 dc             	cmp    %eax,-0x24(%ebp)
c0104ef2:	72 23                	jb     c0104f17 <get_pte+0x11d>
c0104ef4:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0104ef7:	89 44 24 0c          	mov    %eax,0xc(%esp)
c0104efb:	c7 44 24 08 1c 98 10 	movl   $0xc010981c,0x8(%esp)
c0104f02:	c0 
c0104f03:	c7 44 24 04 97 01 00 	movl   $0x197,0x4(%esp)
c0104f0a:	00 
c0104f0b:	c7 04 24 e4 98 10 c0 	movl   $0xc01098e4,(%esp)
c0104f12:	e8 be bd ff ff       	call   c0100cd5 <__panic>
c0104f17:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0104f1a:	2d 00 00 00 40       	sub    $0x40000000,%eax
c0104f1f:	8b 55 0c             	mov    0xc(%ebp),%edx
c0104f22:	c1 ea 0c             	shr    $0xc,%edx
c0104f25:	81 e2 ff 03 00 00    	and    $0x3ff,%edx
c0104f2b:	c1 e2 02             	shl    $0x2,%edx
c0104f2e:	01 d0                	add    %edx,%eax
}
c0104f30:	c9                   	leave  
c0104f31:	c3                   	ret    

c0104f32 <get_page>:

//get_page - get related Page struct for linear address la using PDT pgdir
struct Page *
get_page(pde_t *pgdir, uintptr_t la, pte_t **ptep_store) {
c0104f32:	55                   	push   %ebp
c0104f33:	89 e5                	mov    %esp,%ebp
c0104f35:	83 ec 28             	sub    $0x28,%esp
    pte_t *ptep = get_pte(pgdir, la, 0);
c0104f38:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c0104f3f:	00 
c0104f40:	8b 45 0c             	mov    0xc(%ebp),%eax
c0104f43:	89 44 24 04          	mov    %eax,0x4(%esp)
c0104f47:	8b 45 08             	mov    0x8(%ebp),%eax
c0104f4a:	89 04 24             	mov    %eax,(%esp)
c0104f4d:	e8 a8 fe ff ff       	call   c0104dfa <get_pte>
c0104f52:	89 45 f4             	mov    %eax,-0xc(%ebp)
    if (ptep_store != NULL) {
c0104f55:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
c0104f59:	74 08                	je     c0104f63 <get_page+0x31>
        *ptep_store = ptep;
c0104f5b:	8b 45 10             	mov    0x10(%ebp),%eax
c0104f5e:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0104f61:	89 10                	mov    %edx,(%eax)
    }
    if (ptep != NULL && *ptep & PTE_P) {
c0104f63:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0104f67:	74 1b                	je     c0104f84 <get_page+0x52>
c0104f69:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0104f6c:	8b 00                	mov    (%eax),%eax
c0104f6e:	83 e0 01             	and    $0x1,%eax
c0104f71:	85 c0                	test   %eax,%eax
c0104f73:	74 0f                	je     c0104f84 <get_page+0x52>
        return pa2page(*ptep);
c0104f75:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0104f78:	8b 00                	mov    (%eax),%eax
c0104f7a:	89 04 24             	mov    %eax,(%esp)
c0104f7d:	e8 f0 f3 ff ff       	call   c0104372 <pa2page>
c0104f82:	eb 05                	jmp    c0104f89 <get_page+0x57>
    }
    return NULL;
c0104f84:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0104f89:	c9                   	leave  
c0104f8a:	c3                   	ret    

c0104f8b <page_remove_pte>:

//page_remove_pte - free an Page sturct which is related linear address la
//                - and clean(invalidate) pte which is related linear address la
//note: PT is changed, so the TLB need to be invalidate 
static inline void
page_remove_pte(pde_t *pgdir, uintptr_t la, pte_t *ptep) {
c0104f8b:	55                   	push   %ebp
c0104f8c:	89 e5                	mov    %esp,%ebp
c0104f8e:	83 ec 28             	sub    $0x28,%esp
                                  //(4) and free this page when page reference reachs 0
                                  //(5) clear second page table entry
                                  //(6) flush tlb
    }
#endif
    if (*ptep & PTE_P) {
c0104f91:	8b 45 10             	mov    0x10(%ebp),%eax
c0104f94:	8b 00                	mov    (%eax),%eax
c0104f96:	83 e0 01             	and    $0x1,%eax
c0104f99:	85 c0                	test   %eax,%eax
c0104f9b:	74 4d                	je     c0104fea <page_remove_pte+0x5f>
        struct Page *page = pte2page(*ptep);
c0104f9d:	8b 45 10             	mov    0x10(%ebp),%eax
c0104fa0:	8b 00                	mov    (%eax),%eax
c0104fa2:	89 04 24             	mov    %eax,(%esp)
c0104fa5:	e8 ab f4 ff ff       	call   c0104455 <pte2page>
c0104faa:	89 45 f4             	mov    %eax,-0xc(%ebp)
        if (page_ref_dec(page) == 0) {
c0104fad:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0104fb0:	89 04 24             	mov    %eax,(%esp)
c0104fb3:	e8 09 f5 ff ff       	call   c01044c1 <page_ref_dec>
c0104fb8:	85 c0                	test   %eax,%eax
c0104fba:	75 13                	jne    c0104fcf <page_remove_pte+0x44>
            free_page(page);
c0104fbc:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c0104fc3:	00 
c0104fc4:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0104fc7:	89 04 24             	mov    %eax,(%esp)
c0104fca:	e8 34 f7 ff ff       	call   c0104703 <free_pages>
        }
        *ptep = 0;
c0104fcf:	8b 45 10             	mov    0x10(%ebp),%eax
c0104fd2:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
        tlb_invalidate(pgdir, la);
c0104fd8:	8b 45 0c             	mov    0xc(%ebp),%eax
c0104fdb:	89 44 24 04          	mov    %eax,0x4(%esp)
c0104fdf:	8b 45 08             	mov    0x8(%ebp),%eax
c0104fe2:	89 04 24             	mov    %eax,(%esp)
c0104fe5:	e8 ff 00 00 00       	call   c01050e9 <tlb_invalidate>
    }
}
c0104fea:	c9                   	leave  
c0104feb:	c3                   	ret    

c0104fec <page_remove>:

//page_remove - free an Page which is related linear address la and has an validated pte
void
page_remove(pde_t *pgdir, uintptr_t la) {
c0104fec:	55                   	push   %ebp
c0104fed:	89 e5                	mov    %esp,%ebp
c0104fef:	83 ec 28             	sub    $0x28,%esp
    pte_t *ptep = get_pte(pgdir, la, 0);
c0104ff2:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c0104ff9:	00 
c0104ffa:	8b 45 0c             	mov    0xc(%ebp),%eax
c0104ffd:	89 44 24 04          	mov    %eax,0x4(%esp)
c0105001:	8b 45 08             	mov    0x8(%ebp),%eax
c0105004:	89 04 24             	mov    %eax,(%esp)
c0105007:	e8 ee fd ff ff       	call   c0104dfa <get_pte>
c010500c:	89 45 f4             	mov    %eax,-0xc(%ebp)
    if (ptep != NULL) {
c010500f:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0105013:	74 19                	je     c010502e <page_remove+0x42>
        page_remove_pte(pgdir, la, ptep);
c0105015:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105018:	89 44 24 08          	mov    %eax,0x8(%esp)
c010501c:	8b 45 0c             	mov    0xc(%ebp),%eax
c010501f:	89 44 24 04          	mov    %eax,0x4(%esp)
c0105023:	8b 45 08             	mov    0x8(%ebp),%eax
c0105026:	89 04 24             	mov    %eax,(%esp)
c0105029:	e8 5d ff ff ff       	call   c0104f8b <page_remove_pte>
    }
}
c010502e:	c9                   	leave  
c010502f:	c3                   	ret    

c0105030 <page_insert>:
//  la:    the linear address need to map
//  perm:  the permission of this Page which is setted in related pte
// return value: always 0
//note: PT is changed, so the TLB need to be invalidate 
int
page_insert(pde_t *pgdir, struct Page *page, uintptr_t la, uint32_t perm) {
c0105030:	55                   	push   %ebp
c0105031:	89 e5                	mov    %esp,%ebp
c0105033:	83 ec 28             	sub    $0x28,%esp
    pte_t *ptep = get_pte(pgdir, la, 1);
c0105036:	c7 44 24 08 01 00 00 	movl   $0x1,0x8(%esp)
c010503d:	00 
c010503e:	8b 45 10             	mov    0x10(%ebp),%eax
c0105041:	89 44 24 04          	mov    %eax,0x4(%esp)
c0105045:	8b 45 08             	mov    0x8(%ebp),%eax
c0105048:	89 04 24             	mov    %eax,(%esp)
c010504b:	e8 aa fd ff ff       	call   c0104dfa <get_pte>
c0105050:	89 45 f4             	mov    %eax,-0xc(%ebp)
    if (ptep == NULL) {
c0105053:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0105057:	75 0a                	jne    c0105063 <page_insert+0x33>
        return -E_NO_MEM;
c0105059:	b8 fc ff ff ff       	mov    $0xfffffffc,%eax
c010505e:	e9 84 00 00 00       	jmp    c01050e7 <page_insert+0xb7>
    }
    page_ref_inc(page);
c0105063:	8b 45 0c             	mov    0xc(%ebp),%eax
c0105066:	89 04 24             	mov    %eax,(%esp)
c0105069:	e8 3c f4 ff ff       	call   c01044aa <page_ref_inc>
    if (*ptep & PTE_P) {
c010506e:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105071:	8b 00                	mov    (%eax),%eax
c0105073:	83 e0 01             	and    $0x1,%eax
c0105076:	85 c0                	test   %eax,%eax
c0105078:	74 3e                	je     c01050b8 <page_insert+0x88>
        struct Page *p = pte2page(*ptep);
c010507a:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010507d:	8b 00                	mov    (%eax),%eax
c010507f:	89 04 24             	mov    %eax,(%esp)
c0105082:	e8 ce f3 ff ff       	call   c0104455 <pte2page>
c0105087:	89 45 f0             	mov    %eax,-0x10(%ebp)
        if (p == page) {
c010508a:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010508d:	3b 45 0c             	cmp    0xc(%ebp),%eax
c0105090:	75 0d                	jne    c010509f <page_insert+0x6f>
            page_ref_dec(page);
c0105092:	8b 45 0c             	mov    0xc(%ebp),%eax
c0105095:	89 04 24             	mov    %eax,(%esp)
c0105098:	e8 24 f4 ff ff       	call   c01044c1 <page_ref_dec>
c010509d:	eb 19                	jmp    c01050b8 <page_insert+0x88>
        }
        else {
            page_remove_pte(pgdir, la, ptep);
c010509f:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01050a2:	89 44 24 08          	mov    %eax,0x8(%esp)
c01050a6:	8b 45 10             	mov    0x10(%ebp),%eax
c01050a9:	89 44 24 04          	mov    %eax,0x4(%esp)
c01050ad:	8b 45 08             	mov    0x8(%ebp),%eax
c01050b0:	89 04 24             	mov    %eax,(%esp)
c01050b3:	e8 d3 fe ff ff       	call   c0104f8b <page_remove_pte>
        }
    }
    *ptep = page2pa(page) | PTE_P | perm;
c01050b8:	8b 45 0c             	mov    0xc(%ebp),%eax
c01050bb:	89 04 24             	mov    %eax,(%esp)
c01050be:	e8 99 f2 ff ff       	call   c010435c <page2pa>
c01050c3:	0b 45 14             	or     0x14(%ebp),%eax
c01050c6:	83 c8 01             	or     $0x1,%eax
c01050c9:	89 c2                	mov    %eax,%edx
c01050cb:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01050ce:	89 10                	mov    %edx,(%eax)
    tlb_invalidate(pgdir, la);
c01050d0:	8b 45 10             	mov    0x10(%ebp),%eax
c01050d3:	89 44 24 04          	mov    %eax,0x4(%esp)
c01050d7:	8b 45 08             	mov    0x8(%ebp),%eax
c01050da:	89 04 24             	mov    %eax,(%esp)
c01050dd:	e8 07 00 00 00       	call   c01050e9 <tlb_invalidate>
    return 0;
c01050e2:	b8 00 00 00 00       	mov    $0x0,%eax
}
c01050e7:	c9                   	leave  
c01050e8:	c3                   	ret    

c01050e9 <tlb_invalidate>:

// invalidate a TLB entry, but only if the page tables being
// edited are the ones currently in use by the processor.
void
tlb_invalidate(pde_t *pgdir, uintptr_t la) {
c01050e9:	55                   	push   %ebp
c01050ea:	89 e5                	mov    %esp,%ebp
c01050ec:	83 ec 28             	sub    $0x28,%esp
}

static inline uintptr_t
rcr3(void) {
    uintptr_t cr3;
    asm volatile ("mov %%cr3, %0" : "=r" (cr3) :: "memory");
c01050ef:	0f 20 d8             	mov    %cr3,%eax
c01050f2:	89 45 f0             	mov    %eax,-0x10(%ebp)
    return cr3;
c01050f5:	8b 45 f0             	mov    -0x10(%ebp),%eax
    if (rcr3() == PADDR(pgdir)) {
c01050f8:	89 c2                	mov    %eax,%edx
c01050fa:	8b 45 08             	mov    0x8(%ebp),%eax
c01050fd:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0105100:	81 7d f4 ff ff ff bf 	cmpl   $0xbfffffff,-0xc(%ebp)
c0105107:	77 23                	ja     c010512c <tlb_invalidate+0x43>
c0105109:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010510c:	89 44 24 0c          	mov    %eax,0xc(%esp)
c0105110:	c7 44 24 08 40 98 10 	movl   $0xc0109840,0x8(%esp)
c0105117:	c0 
c0105118:	c7 44 24 04 f9 01 00 	movl   $0x1f9,0x4(%esp)
c010511f:	00 
c0105120:	c7 04 24 e4 98 10 c0 	movl   $0xc01098e4,(%esp)
c0105127:	e8 a9 bb ff ff       	call   c0100cd5 <__panic>
c010512c:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010512f:	05 00 00 00 40       	add    $0x40000000,%eax
c0105134:	39 c2                	cmp    %eax,%edx
c0105136:	75 0c                	jne    c0105144 <tlb_invalidate+0x5b>
        invlpg((void *)la);
c0105138:	8b 45 0c             	mov    0xc(%ebp),%eax
c010513b:	89 45 ec             	mov    %eax,-0x14(%ebp)
}

static inline void
invlpg(void *addr) {
    asm volatile ("invlpg (%0)" :: "r" (addr) : "memory");
c010513e:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0105141:	0f 01 38             	invlpg (%eax)
    }
}
c0105144:	c9                   	leave  
c0105145:	c3                   	ret    

c0105146 <pgdir_alloc_page>:

// pgdir_alloc_page - call alloc_page & page_insert functions to 
//                  - allocate a page size memory & setup an addr map
//                  - pa<->la with linear address la and the PDT pgdir
struct Page *
pgdir_alloc_page(pde_t *pgdir, uintptr_t la, uint32_t perm) {
c0105146:	55                   	push   %ebp
c0105147:	89 e5                	mov    %esp,%ebp
c0105149:	83 ec 28             	sub    $0x28,%esp
    struct Page *page = alloc_page();
c010514c:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0105153:	e8 40 f5 ff ff       	call   c0104698 <alloc_pages>
c0105158:	89 45 f4             	mov    %eax,-0xc(%ebp)
    if (page != NULL) {
c010515b:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c010515f:	0f 84 a7 00 00 00    	je     c010520c <pgdir_alloc_page+0xc6>
        if (page_insert(pgdir, page, la, perm) != 0) {
c0105165:	8b 45 10             	mov    0x10(%ebp),%eax
c0105168:	89 44 24 0c          	mov    %eax,0xc(%esp)
c010516c:	8b 45 0c             	mov    0xc(%ebp),%eax
c010516f:	89 44 24 08          	mov    %eax,0x8(%esp)
c0105173:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105176:	89 44 24 04          	mov    %eax,0x4(%esp)
c010517a:	8b 45 08             	mov    0x8(%ebp),%eax
c010517d:	89 04 24             	mov    %eax,(%esp)
c0105180:	e8 ab fe ff ff       	call   c0105030 <page_insert>
c0105185:	85 c0                	test   %eax,%eax
c0105187:	74 1a                	je     c01051a3 <pgdir_alloc_page+0x5d>
            free_page(page);
c0105189:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c0105190:	00 
c0105191:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105194:	89 04 24             	mov    %eax,(%esp)
c0105197:	e8 67 f5 ff ff       	call   c0104703 <free_pages>
            return NULL;
c010519c:	b8 00 00 00 00       	mov    $0x0,%eax
c01051a1:	eb 6c                	jmp    c010520f <pgdir_alloc_page+0xc9>
        }
        if (swap_init_ok){
c01051a3:	a1 ac 1a 12 c0       	mov    0xc0121aac,%eax
c01051a8:	85 c0                	test   %eax,%eax
c01051aa:	74 60                	je     c010520c <pgdir_alloc_page+0xc6>
            swap_map_swappable(check_mm_struct, la, page, 0);
c01051ac:	a1 ac 1b 12 c0       	mov    0xc0121bac,%eax
c01051b1:	c7 44 24 0c 00 00 00 	movl   $0x0,0xc(%esp)
c01051b8:	00 
c01051b9:	8b 55 f4             	mov    -0xc(%ebp),%edx
c01051bc:	89 54 24 08          	mov    %edx,0x8(%esp)
c01051c0:	8b 55 0c             	mov    0xc(%ebp),%edx
c01051c3:	89 54 24 04          	mov    %edx,0x4(%esp)
c01051c7:	89 04 24             	mov    %eax,(%esp)
c01051ca:	e8 78 0f 00 00       	call   c0106147 <swap_map_swappable>
            page->pra_vaddr=la;
c01051cf:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01051d2:	8b 55 0c             	mov    0xc(%ebp),%edx
c01051d5:	89 50 1c             	mov    %edx,0x1c(%eax)
            assert(page_ref(page) == 1);
c01051d8:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01051db:	89 04 24             	mov    %eax,(%esp)
c01051de:	e8 b0 f2 ff ff       	call   c0104493 <page_ref>
c01051e3:	83 f8 01             	cmp    $0x1,%eax
c01051e6:	74 24                	je     c010520c <pgdir_alloc_page+0xc6>
c01051e8:	c7 44 24 0c 44 99 10 	movl   $0xc0109944,0xc(%esp)
c01051ef:	c0 
c01051f0:	c7 44 24 08 09 99 10 	movl   $0xc0109909,0x8(%esp)
c01051f7:	c0 
c01051f8:	c7 44 24 04 0c 02 00 	movl   $0x20c,0x4(%esp)
c01051ff:	00 
c0105200:	c7 04 24 e4 98 10 c0 	movl   $0xc01098e4,(%esp)
c0105207:	e8 c9 ba ff ff       	call   c0100cd5 <__panic>
            //cprintf("get No. %d  page: pra_vaddr %x, pra_link.prev %x, pra_link_next %x in pgdir_alloc_page\n", (page-pages), page->pra_vaddr,page->pra_page_link.prev, page->pra_page_link.next);
        }

    }

    return page;
c010520c:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c010520f:	c9                   	leave  
c0105210:	c3                   	ret    

c0105211 <check_alloc_page>:

static void
check_alloc_page(void) {
c0105211:	55                   	push   %ebp
c0105212:	89 e5                	mov    %esp,%ebp
c0105214:	83 ec 18             	sub    $0x18,%esp
    pmm_manager->check();
c0105217:	a1 cc 1a 12 c0       	mov    0xc0121acc,%eax
c010521c:	8b 40 18             	mov    0x18(%eax),%eax
c010521f:	ff d0                	call   *%eax
    cprintf("check_alloc_page() succeeded!\n");
c0105221:	c7 04 24 58 99 10 c0 	movl   $0xc0109958,(%esp)
c0105228:	e8 1e b1 ff ff       	call   c010034b <cprintf>
}
c010522d:	c9                   	leave  
c010522e:	c3                   	ret    

c010522f <check_pgdir>:

static void
check_pgdir(void) {
c010522f:	55                   	push   %ebp
c0105230:	89 e5                	mov    %esp,%ebp
c0105232:	83 ec 38             	sub    $0x38,%esp
    assert(npage <= KMEMSIZE / PGSIZE);
c0105235:	a1 20 1a 12 c0       	mov    0xc0121a20,%eax
c010523a:	3d 00 80 03 00       	cmp    $0x38000,%eax
c010523f:	76 24                	jbe    c0105265 <check_pgdir+0x36>
c0105241:	c7 44 24 0c 77 99 10 	movl   $0xc0109977,0xc(%esp)
c0105248:	c0 
c0105249:	c7 44 24 08 09 99 10 	movl   $0xc0109909,0x8(%esp)
c0105250:	c0 
c0105251:	c7 44 24 04 1d 02 00 	movl   $0x21d,0x4(%esp)
c0105258:	00 
c0105259:	c7 04 24 e4 98 10 c0 	movl   $0xc01098e4,(%esp)
c0105260:	e8 70 ba ff ff       	call   c0100cd5 <__panic>
    assert(boot_pgdir != NULL && (uint32_t)PGOFF(boot_pgdir) == 0);
c0105265:	a1 24 1a 12 c0       	mov    0xc0121a24,%eax
c010526a:	85 c0                	test   %eax,%eax
c010526c:	74 0e                	je     c010527c <check_pgdir+0x4d>
c010526e:	a1 24 1a 12 c0       	mov    0xc0121a24,%eax
c0105273:	25 ff 0f 00 00       	and    $0xfff,%eax
c0105278:	85 c0                	test   %eax,%eax
c010527a:	74 24                	je     c01052a0 <check_pgdir+0x71>
c010527c:	c7 44 24 0c 94 99 10 	movl   $0xc0109994,0xc(%esp)
c0105283:	c0 
c0105284:	c7 44 24 08 09 99 10 	movl   $0xc0109909,0x8(%esp)
c010528b:	c0 
c010528c:	c7 44 24 04 1e 02 00 	movl   $0x21e,0x4(%esp)
c0105293:	00 
c0105294:	c7 04 24 e4 98 10 c0 	movl   $0xc01098e4,(%esp)
c010529b:	e8 35 ba ff ff       	call   c0100cd5 <__panic>
    assert(get_page(boot_pgdir, 0x0, NULL) == NULL);
c01052a0:	a1 24 1a 12 c0       	mov    0xc0121a24,%eax
c01052a5:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c01052ac:	00 
c01052ad:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c01052b4:	00 
c01052b5:	89 04 24             	mov    %eax,(%esp)
c01052b8:	e8 75 fc ff ff       	call   c0104f32 <get_page>
c01052bd:	85 c0                	test   %eax,%eax
c01052bf:	74 24                	je     c01052e5 <check_pgdir+0xb6>
c01052c1:	c7 44 24 0c cc 99 10 	movl   $0xc01099cc,0xc(%esp)
c01052c8:	c0 
c01052c9:	c7 44 24 08 09 99 10 	movl   $0xc0109909,0x8(%esp)
c01052d0:	c0 
c01052d1:	c7 44 24 04 1f 02 00 	movl   $0x21f,0x4(%esp)
c01052d8:	00 
c01052d9:	c7 04 24 e4 98 10 c0 	movl   $0xc01098e4,(%esp)
c01052e0:	e8 f0 b9 ff ff       	call   c0100cd5 <__panic>

    struct Page *p1, *p2;
    p1 = alloc_page();
c01052e5:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c01052ec:	e8 a7 f3 ff ff       	call   c0104698 <alloc_pages>
c01052f1:	89 45 f4             	mov    %eax,-0xc(%ebp)
    assert(page_insert(boot_pgdir, p1, 0x0, 0) == 0);
c01052f4:	a1 24 1a 12 c0       	mov    0xc0121a24,%eax
c01052f9:	c7 44 24 0c 00 00 00 	movl   $0x0,0xc(%esp)
c0105300:	00 
c0105301:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c0105308:	00 
c0105309:	8b 55 f4             	mov    -0xc(%ebp),%edx
c010530c:	89 54 24 04          	mov    %edx,0x4(%esp)
c0105310:	89 04 24             	mov    %eax,(%esp)
c0105313:	e8 18 fd ff ff       	call   c0105030 <page_insert>
c0105318:	85 c0                	test   %eax,%eax
c010531a:	74 24                	je     c0105340 <check_pgdir+0x111>
c010531c:	c7 44 24 0c f4 99 10 	movl   $0xc01099f4,0xc(%esp)
c0105323:	c0 
c0105324:	c7 44 24 08 09 99 10 	movl   $0xc0109909,0x8(%esp)
c010532b:	c0 
c010532c:	c7 44 24 04 23 02 00 	movl   $0x223,0x4(%esp)
c0105333:	00 
c0105334:	c7 04 24 e4 98 10 c0 	movl   $0xc01098e4,(%esp)
c010533b:	e8 95 b9 ff ff       	call   c0100cd5 <__panic>

    pte_t *ptep;
    assert((ptep = get_pte(boot_pgdir, 0x0, 0)) != NULL);
c0105340:	a1 24 1a 12 c0       	mov    0xc0121a24,%eax
c0105345:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c010534c:	00 
c010534d:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c0105354:	00 
c0105355:	89 04 24             	mov    %eax,(%esp)
c0105358:	e8 9d fa ff ff       	call   c0104dfa <get_pte>
c010535d:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0105360:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c0105364:	75 24                	jne    c010538a <check_pgdir+0x15b>
c0105366:	c7 44 24 0c 20 9a 10 	movl   $0xc0109a20,0xc(%esp)
c010536d:	c0 
c010536e:	c7 44 24 08 09 99 10 	movl   $0xc0109909,0x8(%esp)
c0105375:	c0 
c0105376:	c7 44 24 04 26 02 00 	movl   $0x226,0x4(%esp)
c010537d:	00 
c010537e:	c7 04 24 e4 98 10 c0 	movl   $0xc01098e4,(%esp)
c0105385:	e8 4b b9 ff ff       	call   c0100cd5 <__panic>
    assert(pa2page(*ptep) == p1);
c010538a:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010538d:	8b 00                	mov    (%eax),%eax
c010538f:	89 04 24             	mov    %eax,(%esp)
c0105392:	e8 db ef ff ff       	call   c0104372 <pa2page>
c0105397:	3b 45 f4             	cmp    -0xc(%ebp),%eax
c010539a:	74 24                	je     c01053c0 <check_pgdir+0x191>
c010539c:	c7 44 24 0c 4d 9a 10 	movl   $0xc0109a4d,0xc(%esp)
c01053a3:	c0 
c01053a4:	c7 44 24 08 09 99 10 	movl   $0xc0109909,0x8(%esp)
c01053ab:	c0 
c01053ac:	c7 44 24 04 27 02 00 	movl   $0x227,0x4(%esp)
c01053b3:	00 
c01053b4:	c7 04 24 e4 98 10 c0 	movl   $0xc01098e4,(%esp)
c01053bb:	e8 15 b9 ff ff       	call   c0100cd5 <__panic>
    assert(page_ref(p1) == 1);
c01053c0:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01053c3:	89 04 24             	mov    %eax,(%esp)
c01053c6:	e8 c8 f0 ff ff       	call   c0104493 <page_ref>
c01053cb:	83 f8 01             	cmp    $0x1,%eax
c01053ce:	74 24                	je     c01053f4 <check_pgdir+0x1c5>
c01053d0:	c7 44 24 0c 62 9a 10 	movl   $0xc0109a62,0xc(%esp)
c01053d7:	c0 
c01053d8:	c7 44 24 08 09 99 10 	movl   $0xc0109909,0x8(%esp)
c01053df:	c0 
c01053e0:	c7 44 24 04 28 02 00 	movl   $0x228,0x4(%esp)
c01053e7:	00 
c01053e8:	c7 04 24 e4 98 10 c0 	movl   $0xc01098e4,(%esp)
c01053ef:	e8 e1 b8 ff ff       	call   c0100cd5 <__panic>

    ptep = &((pte_t *)KADDR(PDE_ADDR(boot_pgdir[0])))[1];
c01053f4:	a1 24 1a 12 c0       	mov    0xc0121a24,%eax
c01053f9:	8b 00                	mov    (%eax),%eax
c01053fb:	25 00 f0 ff ff       	and    $0xfffff000,%eax
c0105400:	89 45 ec             	mov    %eax,-0x14(%ebp)
c0105403:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0105406:	c1 e8 0c             	shr    $0xc,%eax
c0105409:	89 45 e8             	mov    %eax,-0x18(%ebp)
c010540c:	a1 20 1a 12 c0       	mov    0xc0121a20,%eax
c0105411:	39 45 e8             	cmp    %eax,-0x18(%ebp)
c0105414:	72 23                	jb     c0105439 <check_pgdir+0x20a>
c0105416:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0105419:	89 44 24 0c          	mov    %eax,0xc(%esp)
c010541d:	c7 44 24 08 1c 98 10 	movl   $0xc010981c,0x8(%esp)
c0105424:	c0 
c0105425:	c7 44 24 04 2a 02 00 	movl   $0x22a,0x4(%esp)
c010542c:	00 
c010542d:	c7 04 24 e4 98 10 c0 	movl   $0xc01098e4,(%esp)
c0105434:	e8 9c b8 ff ff       	call   c0100cd5 <__panic>
c0105439:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010543c:	2d 00 00 00 40       	sub    $0x40000000,%eax
c0105441:	83 c0 04             	add    $0x4,%eax
c0105444:	89 45 f0             	mov    %eax,-0x10(%ebp)
    assert(get_pte(boot_pgdir, PGSIZE, 0) == ptep);
c0105447:	a1 24 1a 12 c0       	mov    0xc0121a24,%eax
c010544c:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c0105453:	00 
c0105454:	c7 44 24 04 00 10 00 	movl   $0x1000,0x4(%esp)
c010545b:	00 
c010545c:	89 04 24             	mov    %eax,(%esp)
c010545f:	e8 96 f9 ff ff       	call   c0104dfa <get_pte>
c0105464:	3b 45 f0             	cmp    -0x10(%ebp),%eax
c0105467:	74 24                	je     c010548d <check_pgdir+0x25e>
c0105469:	c7 44 24 0c 74 9a 10 	movl   $0xc0109a74,0xc(%esp)
c0105470:	c0 
c0105471:	c7 44 24 08 09 99 10 	movl   $0xc0109909,0x8(%esp)
c0105478:	c0 
c0105479:	c7 44 24 04 2b 02 00 	movl   $0x22b,0x4(%esp)
c0105480:	00 
c0105481:	c7 04 24 e4 98 10 c0 	movl   $0xc01098e4,(%esp)
c0105488:	e8 48 b8 ff ff       	call   c0100cd5 <__panic>

    p2 = alloc_page();
c010548d:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0105494:	e8 ff f1 ff ff       	call   c0104698 <alloc_pages>
c0105499:	89 45 e4             	mov    %eax,-0x1c(%ebp)
    assert(page_insert(boot_pgdir, p2, PGSIZE, PTE_U | PTE_W) == 0);
c010549c:	a1 24 1a 12 c0       	mov    0xc0121a24,%eax
c01054a1:	c7 44 24 0c 06 00 00 	movl   $0x6,0xc(%esp)
c01054a8:	00 
c01054a9:	c7 44 24 08 00 10 00 	movl   $0x1000,0x8(%esp)
c01054b0:	00 
c01054b1:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c01054b4:	89 54 24 04          	mov    %edx,0x4(%esp)
c01054b8:	89 04 24             	mov    %eax,(%esp)
c01054bb:	e8 70 fb ff ff       	call   c0105030 <page_insert>
c01054c0:	85 c0                	test   %eax,%eax
c01054c2:	74 24                	je     c01054e8 <check_pgdir+0x2b9>
c01054c4:	c7 44 24 0c 9c 9a 10 	movl   $0xc0109a9c,0xc(%esp)
c01054cb:	c0 
c01054cc:	c7 44 24 08 09 99 10 	movl   $0xc0109909,0x8(%esp)
c01054d3:	c0 
c01054d4:	c7 44 24 04 2e 02 00 	movl   $0x22e,0x4(%esp)
c01054db:	00 
c01054dc:	c7 04 24 e4 98 10 c0 	movl   $0xc01098e4,(%esp)
c01054e3:	e8 ed b7 ff ff       	call   c0100cd5 <__panic>
    assert((ptep = get_pte(boot_pgdir, PGSIZE, 0)) != NULL);
c01054e8:	a1 24 1a 12 c0       	mov    0xc0121a24,%eax
c01054ed:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c01054f4:	00 
c01054f5:	c7 44 24 04 00 10 00 	movl   $0x1000,0x4(%esp)
c01054fc:	00 
c01054fd:	89 04 24             	mov    %eax,(%esp)
c0105500:	e8 f5 f8 ff ff       	call   c0104dfa <get_pte>
c0105505:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0105508:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c010550c:	75 24                	jne    c0105532 <check_pgdir+0x303>
c010550e:	c7 44 24 0c d4 9a 10 	movl   $0xc0109ad4,0xc(%esp)
c0105515:	c0 
c0105516:	c7 44 24 08 09 99 10 	movl   $0xc0109909,0x8(%esp)
c010551d:	c0 
c010551e:	c7 44 24 04 2f 02 00 	movl   $0x22f,0x4(%esp)
c0105525:	00 
c0105526:	c7 04 24 e4 98 10 c0 	movl   $0xc01098e4,(%esp)
c010552d:	e8 a3 b7 ff ff       	call   c0100cd5 <__panic>
    assert(*ptep & PTE_U);
c0105532:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0105535:	8b 00                	mov    (%eax),%eax
c0105537:	83 e0 04             	and    $0x4,%eax
c010553a:	85 c0                	test   %eax,%eax
c010553c:	75 24                	jne    c0105562 <check_pgdir+0x333>
c010553e:	c7 44 24 0c 04 9b 10 	movl   $0xc0109b04,0xc(%esp)
c0105545:	c0 
c0105546:	c7 44 24 08 09 99 10 	movl   $0xc0109909,0x8(%esp)
c010554d:	c0 
c010554e:	c7 44 24 04 30 02 00 	movl   $0x230,0x4(%esp)
c0105555:	00 
c0105556:	c7 04 24 e4 98 10 c0 	movl   $0xc01098e4,(%esp)
c010555d:	e8 73 b7 ff ff       	call   c0100cd5 <__panic>
    assert(*ptep & PTE_W);
c0105562:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0105565:	8b 00                	mov    (%eax),%eax
c0105567:	83 e0 02             	and    $0x2,%eax
c010556a:	85 c0                	test   %eax,%eax
c010556c:	75 24                	jne    c0105592 <check_pgdir+0x363>
c010556e:	c7 44 24 0c 12 9b 10 	movl   $0xc0109b12,0xc(%esp)
c0105575:	c0 
c0105576:	c7 44 24 08 09 99 10 	movl   $0xc0109909,0x8(%esp)
c010557d:	c0 
c010557e:	c7 44 24 04 31 02 00 	movl   $0x231,0x4(%esp)
c0105585:	00 
c0105586:	c7 04 24 e4 98 10 c0 	movl   $0xc01098e4,(%esp)
c010558d:	e8 43 b7 ff ff       	call   c0100cd5 <__panic>
    assert(boot_pgdir[0] & PTE_U);
c0105592:	a1 24 1a 12 c0       	mov    0xc0121a24,%eax
c0105597:	8b 00                	mov    (%eax),%eax
c0105599:	83 e0 04             	and    $0x4,%eax
c010559c:	85 c0                	test   %eax,%eax
c010559e:	75 24                	jne    c01055c4 <check_pgdir+0x395>
c01055a0:	c7 44 24 0c 20 9b 10 	movl   $0xc0109b20,0xc(%esp)
c01055a7:	c0 
c01055a8:	c7 44 24 08 09 99 10 	movl   $0xc0109909,0x8(%esp)
c01055af:	c0 
c01055b0:	c7 44 24 04 32 02 00 	movl   $0x232,0x4(%esp)
c01055b7:	00 
c01055b8:	c7 04 24 e4 98 10 c0 	movl   $0xc01098e4,(%esp)
c01055bf:	e8 11 b7 ff ff       	call   c0100cd5 <__panic>
    assert(page_ref(p2) == 1);
c01055c4:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c01055c7:	89 04 24             	mov    %eax,(%esp)
c01055ca:	e8 c4 ee ff ff       	call   c0104493 <page_ref>
c01055cf:	83 f8 01             	cmp    $0x1,%eax
c01055d2:	74 24                	je     c01055f8 <check_pgdir+0x3c9>
c01055d4:	c7 44 24 0c 36 9b 10 	movl   $0xc0109b36,0xc(%esp)
c01055db:	c0 
c01055dc:	c7 44 24 08 09 99 10 	movl   $0xc0109909,0x8(%esp)
c01055e3:	c0 
c01055e4:	c7 44 24 04 33 02 00 	movl   $0x233,0x4(%esp)
c01055eb:	00 
c01055ec:	c7 04 24 e4 98 10 c0 	movl   $0xc01098e4,(%esp)
c01055f3:	e8 dd b6 ff ff       	call   c0100cd5 <__panic>

    assert(page_insert(boot_pgdir, p1, PGSIZE, 0) == 0);
c01055f8:	a1 24 1a 12 c0       	mov    0xc0121a24,%eax
c01055fd:	c7 44 24 0c 00 00 00 	movl   $0x0,0xc(%esp)
c0105604:	00 
c0105605:	c7 44 24 08 00 10 00 	movl   $0x1000,0x8(%esp)
c010560c:	00 
c010560d:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0105610:	89 54 24 04          	mov    %edx,0x4(%esp)
c0105614:	89 04 24             	mov    %eax,(%esp)
c0105617:	e8 14 fa ff ff       	call   c0105030 <page_insert>
c010561c:	85 c0                	test   %eax,%eax
c010561e:	74 24                	je     c0105644 <check_pgdir+0x415>
c0105620:	c7 44 24 0c 48 9b 10 	movl   $0xc0109b48,0xc(%esp)
c0105627:	c0 
c0105628:	c7 44 24 08 09 99 10 	movl   $0xc0109909,0x8(%esp)
c010562f:	c0 
c0105630:	c7 44 24 04 35 02 00 	movl   $0x235,0x4(%esp)
c0105637:	00 
c0105638:	c7 04 24 e4 98 10 c0 	movl   $0xc01098e4,(%esp)
c010563f:	e8 91 b6 ff ff       	call   c0100cd5 <__panic>
    assert(page_ref(p1) == 2);
c0105644:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105647:	89 04 24             	mov    %eax,(%esp)
c010564a:	e8 44 ee ff ff       	call   c0104493 <page_ref>
c010564f:	83 f8 02             	cmp    $0x2,%eax
c0105652:	74 24                	je     c0105678 <check_pgdir+0x449>
c0105654:	c7 44 24 0c 74 9b 10 	movl   $0xc0109b74,0xc(%esp)
c010565b:	c0 
c010565c:	c7 44 24 08 09 99 10 	movl   $0xc0109909,0x8(%esp)
c0105663:	c0 
c0105664:	c7 44 24 04 36 02 00 	movl   $0x236,0x4(%esp)
c010566b:	00 
c010566c:	c7 04 24 e4 98 10 c0 	movl   $0xc01098e4,(%esp)
c0105673:	e8 5d b6 ff ff       	call   c0100cd5 <__panic>
    assert(page_ref(p2) == 0);
c0105678:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c010567b:	89 04 24             	mov    %eax,(%esp)
c010567e:	e8 10 ee ff ff       	call   c0104493 <page_ref>
c0105683:	85 c0                	test   %eax,%eax
c0105685:	74 24                	je     c01056ab <check_pgdir+0x47c>
c0105687:	c7 44 24 0c 86 9b 10 	movl   $0xc0109b86,0xc(%esp)
c010568e:	c0 
c010568f:	c7 44 24 08 09 99 10 	movl   $0xc0109909,0x8(%esp)
c0105696:	c0 
c0105697:	c7 44 24 04 37 02 00 	movl   $0x237,0x4(%esp)
c010569e:	00 
c010569f:	c7 04 24 e4 98 10 c0 	movl   $0xc01098e4,(%esp)
c01056a6:	e8 2a b6 ff ff       	call   c0100cd5 <__panic>
    assert((ptep = get_pte(boot_pgdir, PGSIZE, 0)) != NULL);
c01056ab:	a1 24 1a 12 c0       	mov    0xc0121a24,%eax
c01056b0:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c01056b7:	00 
c01056b8:	c7 44 24 04 00 10 00 	movl   $0x1000,0x4(%esp)
c01056bf:	00 
c01056c0:	89 04 24             	mov    %eax,(%esp)
c01056c3:	e8 32 f7 ff ff       	call   c0104dfa <get_pte>
c01056c8:	89 45 f0             	mov    %eax,-0x10(%ebp)
c01056cb:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c01056cf:	75 24                	jne    c01056f5 <check_pgdir+0x4c6>
c01056d1:	c7 44 24 0c d4 9a 10 	movl   $0xc0109ad4,0xc(%esp)
c01056d8:	c0 
c01056d9:	c7 44 24 08 09 99 10 	movl   $0xc0109909,0x8(%esp)
c01056e0:	c0 
c01056e1:	c7 44 24 04 38 02 00 	movl   $0x238,0x4(%esp)
c01056e8:	00 
c01056e9:	c7 04 24 e4 98 10 c0 	movl   $0xc01098e4,(%esp)
c01056f0:	e8 e0 b5 ff ff       	call   c0100cd5 <__panic>
    assert(pa2page(*ptep) == p1);
c01056f5:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01056f8:	8b 00                	mov    (%eax),%eax
c01056fa:	89 04 24             	mov    %eax,(%esp)
c01056fd:	e8 70 ec ff ff       	call   c0104372 <pa2page>
c0105702:	3b 45 f4             	cmp    -0xc(%ebp),%eax
c0105705:	74 24                	je     c010572b <check_pgdir+0x4fc>
c0105707:	c7 44 24 0c 4d 9a 10 	movl   $0xc0109a4d,0xc(%esp)
c010570e:	c0 
c010570f:	c7 44 24 08 09 99 10 	movl   $0xc0109909,0x8(%esp)
c0105716:	c0 
c0105717:	c7 44 24 04 39 02 00 	movl   $0x239,0x4(%esp)
c010571e:	00 
c010571f:	c7 04 24 e4 98 10 c0 	movl   $0xc01098e4,(%esp)
c0105726:	e8 aa b5 ff ff       	call   c0100cd5 <__panic>
    assert((*ptep & PTE_U) == 0);
c010572b:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010572e:	8b 00                	mov    (%eax),%eax
c0105730:	83 e0 04             	and    $0x4,%eax
c0105733:	85 c0                	test   %eax,%eax
c0105735:	74 24                	je     c010575b <check_pgdir+0x52c>
c0105737:	c7 44 24 0c 98 9b 10 	movl   $0xc0109b98,0xc(%esp)
c010573e:	c0 
c010573f:	c7 44 24 08 09 99 10 	movl   $0xc0109909,0x8(%esp)
c0105746:	c0 
c0105747:	c7 44 24 04 3a 02 00 	movl   $0x23a,0x4(%esp)
c010574e:	00 
c010574f:	c7 04 24 e4 98 10 c0 	movl   $0xc01098e4,(%esp)
c0105756:	e8 7a b5 ff ff       	call   c0100cd5 <__panic>

    page_remove(boot_pgdir, 0x0);
c010575b:	a1 24 1a 12 c0       	mov    0xc0121a24,%eax
c0105760:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c0105767:	00 
c0105768:	89 04 24             	mov    %eax,(%esp)
c010576b:	e8 7c f8 ff ff       	call   c0104fec <page_remove>
    assert(page_ref(p1) == 1);
c0105770:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105773:	89 04 24             	mov    %eax,(%esp)
c0105776:	e8 18 ed ff ff       	call   c0104493 <page_ref>
c010577b:	83 f8 01             	cmp    $0x1,%eax
c010577e:	74 24                	je     c01057a4 <check_pgdir+0x575>
c0105780:	c7 44 24 0c 62 9a 10 	movl   $0xc0109a62,0xc(%esp)
c0105787:	c0 
c0105788:	c7 44 24 08 09 99 10 	movl   $0xc0109909,0x8(%esp)
c010578f:	c0 
c0105790:	c7 44 24 04 3d 02 00 	movl   $0x23d,0x4(%esp)
c0105797:	00 
c0105798:	c7 04 24 e4 98 10 c0 	movl   $0xc01098e4,(%esp)
c010579f:	e8 31 b5 ff ff       	call   c0100cd5 <__panic>
    assert(page_ref(p2) == 0);
c01057a4:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c01057a7:	89 04 24             	mov    %eax,(%esp)
c01057aa:	e8 e4 ec ff ff       	call   c0104493 <page_ref>
c01057af:	85 c0                	test   %eax,%eax
c01057b1:	74 24                	je     c01057d7 <check_pgdir+0x5a8>
c01057b3:	c7 44 24 0c 86 9b 10 	movl   $0xc0109b86,0xc(%esp)
c01057ba:	c0 
c01057bb:	c7 44 24 08 09 99 10 	movl   $0xc0109909,0x8(%esp)
c01057c2:	c0 
c01057c3:	c7 44 24 04 3e 02 00 	movl   $0x23e,0x4(%esp)
c01057ca:	00 
c01057cb:	c7 04 24 e4 98 10 c0 	movl   $0xc01098e4,(%esp)
c01057d2:	e8 fe b4 ff ff       	call   c0100cd5 <__panic>

    page_remove(boot_pgdir, PGSIZE);
c01057d7:	a1 24 1a 12 c0       	mov    0xc0121a24,%eax
c01057dc:	c7 44 24 04 00 10 00 	movl   $0x1000,0x4(%esp)
c01057e3:	00 
c01057e4:	89 04 24             	mov    %eax,(%esp)
c01057e7:	e8 00 f8 ff ff       	call   c0104fec <page_remove>
    assert(page_ref(p1) == 0);
c01057ec:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01057ef:	89 04 24             	mov    %eax,(%esp)
c01057f2:	e8 9c ec ff ff       	call   c0104493 <page_ref>
c01057f7:	85 c0                	test   %eax,%eax
c01057f9:	74 24                	je     c010581f <check_pgdir+0x5f0>
c01057fb:	c7 44 24 0c ad 9b 10 	movl   $0xc0109bad,0xc(%esp)
c0105802:	c0 
c0105803:	c7 44 24 08 09 99 10 	movl   $0xc0109909,0x8(%esp)
c010580a:	c0 
c010580b:	c7 44 24 04 41 02 00 	movl   $0x241,0x4(%esp)
c0105812:	00 
c0105813:	c7 04 24 e4 98 10 c0 	movl   $0xc01098e4,(%esp)
c010581a:	e8 b6 b4 ff ff       	call   c0100cd5 <__panic>
    assert(page_ref(p2) == 0);
c010581f:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0105822:	89 04 24             	mov    %eax,(%esp)
c0105825:	e8 69 ec ff ff       	call   c0104493 <page_ref>
c010582a:	85 c0                	test   %eax,%eax
c010582c:	74 24                	je     c0105852 <check_pgdir+0x623>
c010582e:	c7 44 24 0c 86 9b 10 	movl   $0xc0109b86,0xc(%esp)
c0105835:	c0 
c0105836:	c7 44 24 08 09 99 10 	movl   $0xc0109909,0x8(%esp)
c010583d:	c0 
c010583e:	c7 44 24 04 42 02 00 	movl   $0x242,0x4(%esp)
c0105845:	00 
c0105846:	c7 04 24 e4 98 10 c0 	movl   $0xc01098e4,(%esp)
c010584d:	e8 83 b4 ff ff       	call   c0100cd5 <__panic>

    assert(page_ref(pa2page(boot_pgdir[0])) == 1);
c0105852:	a1 24 1a 12 c0       	mov    0xc0121a24,%eax
c0105857:	8b 00                	mov    (%eax),%eax
c0105859:	89 04 24             	mov    %eax,(%esp)
c010585c:	e8 11 eb ff ff       	call   c0104372 <pa2page>
c0105861:	89 04 24             	mov    %eax,(%esp)
c0105864:	e8 2a ec ff ff       	call   c0104493 <page_ref>
c0105869:	83 f8 01             	cmp    $0x1,%eax
c010586c:	74 24                	je     c0105892 <check_pgdir+0x663>
c010586e:	c7 44 24 0c c0 9b 10 	movl   $0xc0109bc0,0xc(%esp)
c0105875:	c0 
c0105876:	c7 44 24 08 09 99 10 	movl   $0xc0109909,0x8(%esp)
c010587d:	c0 
c010587e:	c7 44 24 04 44 02 00 	movl   $0x244,0x4(%esp)
c0105885:	00 
c0105886:	c7 04 24 e4 98 10 c0 	movl   $0xc01098e4,(%esp)
c010588d:	e8 43 b4 ff ff       	call   c0100cd5 <__panic>
    free_page(pa2page(boot_pgdir[0]));
c0105892:	a1 24 1a 12 c0       	mov    0xc0121a24,%eax
c0105897:	8b 00                	mov    (%eax),%eax
c0105899:	89 04 24             	mov    %eax,(%esp)
c010589c:	e8 d1 ea ff ff       	call   c0104372 <pa2page>
c01058a1:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c01058a8:	00 
c01058a9:	89 04 24             	mov    %eax,(%esp)
c01058ac:	e8 52 ee ff ff       	call   c0104703 <free_pages>
    boot_pgdir[0] = 0;
c01058b1:	a1 24 1a 12 c0       	mov    0xc0121a24,%eax
c01058b6:	c7 00 00 00 00 00    	movl   $0x0,(%eax)

    cprintf("check_pgdir() succeeded!\n");
c01058bc:	c7 04 24 e6 9b 10 c0 	movl   $0xc0109be6,(%esp)
c01058c3:	e8 83 aa ff ff       	call   c010034b <cprintf>
}
c01058c8:	c9                   	leave  
c01058c9:	c3                   	ret    

c01058ca <check_boot_pgdir>:

static void
check_boot_pgdir(void) {
c01058ca:	55                   	push   %ebp
c01058cb:	89 e5                	mov    %esp,%ebp
c01058cd:	83 ec 38             	sub    $0x38,%esp
    pte_t *ptep;
    int i;
    for (i = 0; i < npage; i += PGSIZE) {
c01058d0:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
c01058d7:	e9 ca 00 00 00       	jmp    c01059a6 <check_boot_pgdir+0xdc>
        assert((ptep = get_pte(boot_pgdir, (uintptr_t)KADDR(i), 0)) != NULL);
c01058dc:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01058df:	89 45 f0             	mov    %eax,-0x10(%ebp)
c01058e2:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01058e5:	c1 e8 0c             	shr    $0xc,%eax
c01058e8:	89 45 ec             	mov    %eax,-0x14(%ebp)
c01058eb:	a1 20 1a 12 c0       	mov    0xc0121a20,%eax
c01058f0:	39 45 ec             	cmp    %eax,-0x14(%ebp)
c01058f3:	72 23                	jb     c0105918 <check_boot_pgdir+0x4e>
c01058f5:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01058f8:	89 44 24 0c          	mov    %eax,0xc(%esp)
c01058fc:	c7 44 24 08 1c 98 10 	movl   $0xc010981c,0x8(%esp)
c0105903:	c0 
c0105904:	c7 44 24 04 50 02 00 	movl   $0x250,0x4(%esp)
c010590b:	00 
c010590c:	c7 04 24 e4 98 10 c0 	movl   $0xc01098e4,(%esp)
c0105913:	e8 bd b3 ff ff       	call   c0100cd5 <__panic>
c0105918:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010591b:	2d 00 00 00 40       	sub    $0x40000000,%eax
c0105920:	89 c2                	mov    %eax,%edx
c0105922:	a1 24 1a 12 c0       	mov    0xc0121a24,%eax
c0105927:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c010592e:	00 
c010592f:	89 54 24 04          	mov    %edx,0x4(%esp)
c0105933:	89 04 24             	mov    %eax,(%esp)
c0105936:	e8 bf f4 ff ff       	call   c0104dfa <get_pte>
c010593b:	89 45 e8             	mov    %eax,-0x18(%ebp)
c010593e:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
c0105942:	75 24                	jne    c0105968 <check_boot_pgdir+0x9e>
c0105944:	c7 44 24 0c 00 9c 10 	movl   $0xc0109c00,0xc(%esp)
c010594b:	c0 
c010594c:	c7 44 24 08 09 99 10 	movl   $0xc0109909,0x8(%esp)
c0105953:	c0 
c0105954:	c7 44 24 04 50 02 00 	movl   $0x250,0x4(%esp)
c010595b:	00 
c010595c:	c7 04 24 e4 98 10 c0 	movl   $0xc01098e4,(%esp)
c0105963:	e8 6d b3 ff ff       	call   c0100cd5 <__panic>
        assert(PTE_ADDR(*ptep) == i);
c0105968:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010596b:	8b 00                	mov    (%eax),%eax
c010596d:	25 00 f0 ff ff       	and    $0xfffff000,%eax
c0105972:	89 c2                	mov    %eax,%edx
c0105974:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105977:	39 c2                	cmp    %eax,%edx
c0105979:	74 24                	je     c010599f <check_boot_pgdir+0xd5>
c010597b:	c7 44 24 0c 3d 9c 10 	movl   $0xc0109c3d,0xc(%esp)
c0105982:	c0 
c0105983:	c7 44 24 08 09 99 10 	movl   $0xc0109909,0x8(%esp)
c010598a:	c0 
c010598b:	c7 44 24 04 51 02 00 	movl   $0x251,0x4(%esp)
c0105992:	00 
c0105993:	c7 04 24 e4 98 10 c0 	movl   $0xc01098e4,(%esp)
c010599a:	e8 36 b3 ff ff       	call   c0100cd5 <__panic>

static void
check_boot_pgdir(void) {
    pte_t *ptep;
    int i;
    for (i = 0; i < npage; i += PGSIZE) {
c010599f:	81 45 f4 00 10 00 00 	addl   $0x1000,-0xc(%ebp)
c01059a6:	8b 55 f4             	mov    -0xc(%ebp),%edx
c01059a9:	a1 20 1a 12 c0       	mov    0xc0121a20,%eax
c01059ae:	39 c2                	cmp    %eax,%edx
c01059b0:	0f 82 26 ff ff ff    	jb     c01058dc <check_boot_pgdir+0x12>
        assert((ptep = get_pte(boot_pgdir, (uintptr_t)KADDR(i), 0)) != NULL);
        assert(PTE_ADDR(*ptep) == i);
    }

    assert(PDE_ADDR(boot_pgdir[PDX(VPT)]) == PADDR(boot_pgdir));
c01059b6:	a1 24 1a 12 c0       	mov    0xc0121a24,%eax
c01059bb:	05 ac 0f 00 00       	add    $0xfac,%eax
c01059c0:	8b 00                	mov    (%eax),%eax
c01059c2:	25 00 f0 ff ff       	and    $0xfffff000,%eax
c01059c7:	89 c2                	mov    %eax,%edx
c01059c9:	a1 24 1a 12 c0       	mov    0xc0121a24,%eax
c01059ce:	89 45 e4             	mov    %eax,-0x1c(%ebp)
c01059d1:	81 7d e4 ff ff ff bf 	cmpl   $0xbfffffff,-0x1c(%ebp)
c01059d8:	77 23                	ja     c01059fd <check_boot_pgdir+0x133>
c01059da:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c01059dd:	89 44 24 0c          	mov    %eax,0xc(%esp)
c01059e1:	c7 44 24 08 40 98 10 	movl   $0xc0109840,0x8(%esp)
c01059e8:	c0 
c01059e9:	c7 44 24 04 54 02 00 	movl   $0x254,0x4(%esp)
c01059f0:	00 
c01059f1:	c7 04 24 e4 98 10 c0 	movl   $0xc01098e4,(%esp)
c01059f8:	e8 d8 b2 ff ff       	call   c0100cd5 <__panic>
c01059fd:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0105a00:	05 00 00 00 40       	add    $0x40000000,%eax
c0105a05:	39 c2                	cmp    %eax,%edx
c0105a07:	74 24                	je     c0105a2d <check_boot_pgdir+0x163>
c0105a09:	c7 44 24 0c 54 9c 10 	movl   $0xc0109c54,0xc(%esp)
c0105a10:	c0 
c0105a11:	c7 44 24 08 09 99 10 	movl   $0xc0109909,0x8(%esp)
c0105a18:	c0 
c0105a19:	c7 44 24 04 54 02 00 	movl   $0x254,0x4(%esp)
c0105a20:	00 
c0105a21:	c7 04 24 e4 98 10 c0 	movl   $0xc01098e4,(%esp)
c0105a28:	e8 a8 b2 ff ff       	call   c0100cd5 <__panic>

    assert(boot_pgdir[0] == 0);
c0105a2d:	a1 24 1a 12 c0       	mov    0xc0121a24,%eax
c0105a32:	8b 00                	mov    (%eax),%eax
c0105a34:	85 c0                	test   %eax,%eax
c0105a36:	74 24                	je     c0105a5c <check_boot_pgdir+0x192>
c0105a38:	c7 44 24 0c 88 9c 10 	movl   $0xc0109c88,0xc(%esp)
c0105a3f:	c0 
c0105a40:	c7 44 24 08 09 99 10 	movl   $0xc0109909,0x8(%esp)
c0105a47:	c0 
c0105a48:	c7 44 24 04 56 02 00 	movl   $0x256,0x4(%esp)
c0105a4f:	00 
c0105a50:	c7 04 24 e4 98 10 c0 	movl   $0xc01098e4,(%esp)
c0105a57:	e8 79 b2 ff ff       	call   c0100cd5 <__panic>

    struct Page *p;
    p = alloc_page();
c0105a5c:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0105a63:	e8 30 ec ff ff       	call   c0104698 <alloc_pages>
c0105a68:	89 45 e0             	mov    %eax,-0x20(%ebp)
    assert(page_insert(boot_pgdir, p, 0x100, PTE_W) == 0);
c0105a6b:	a1 24 1a 12 c0       	mov    0xc0121a24,%eax
c0105a70:	c7 44 24 0c 02 00 00 	movl   $0x2,0xc(%esp)
c0105a77:	00 
c0105a78:	c7 44 24 08 00 01 00 	movl   $0x100,0x8(%esp)
c0105a7f:	00 
c0105a80:	8b 55 e0             	mov    -0x20(%ebp),%edx
c0105a83:	89 54 24 04          	mov    %edx,0x4(%esp)
c0105a87:	89 04 24             	mov    %eax,(%esp)
c0105a8a:	e8 a1 f5 ff ff       	call   c0105030 <page_insert>
c0105a8f:	85 c0                	test   %eax,%eax
c0105a91:	74 24                	je     c0105ab7 <check_boot_pgdir+0x1ed>
c0105a93:	c7 44 24 0c 9c 9c 10 	movl   $0xc0109c9c,0xc(%esp)
c0105a9a:	c0 
c0105a9b:	c7 44 24 08 09 99 10 	movl   $0xc0109909,0x8(%esp)
c0105aa2:	c0 
c0105aa3:	c7 44 24 04 5a 02 00 	movl   $0x25a,0x4(%esp)
c0105aaa:	00 
c0105aab:	c7 04 24 e4 98 10 c0 	movl   $0xc01098e4,(%esp)
c0105ab2:	e8 1e b2 ff ff       	call   c0100cd5 <__panic>
    assert(page_ref(p) == 1);
c0105ab7:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0105aba:	89 04 24             	mov    %eax,(%esp)
c0105abd:	e8 d1 e9 ff ff       	call   c0104493 <page_ref>
c0105ac2:	83 f8 01             	cmp    $0x1,%eax
c0105ac5:	74 24                	je     c0105aeb <check_boot_pgdir+0x221>
c0105ac7:	c7 44 24 0c ca 9c 10 	movl   $0xc0109cca,0xc(%esp)
c0105ace:	c0 
c0105acf:	c7 44 24 08 09 99 10 	movl   $0xc0109909,0x8(%esp)
c0105ad6:	c0 
c0105ad7:	c7 44 24 04 5b 02 00 	movl   $0x25b,0x4(%esp)
c0105ade:	00 
c0105adf:	c7 04 24 e4 98 10 c0 	movl   $0xc01098e4,(%esp)
c0105ae6:	e8 ea b1 ff ff       	call   c0100cd5 <__panic>
    assert(page_insert(boot_pgdir, p, 0x100 + PGSIZE, PTE_W) == 0);
c0105aeb:	a1 24 1a 12 c0       	mov    0xc0121a24,%eax
c0105af0:	c7 44 24 0c 02 00 00 	movl   $0x2,0xc(%esp)
c0105af7:	00 
c0105af8:	c7 44 24 08 00 11 00 	movl   $0x1100,0x8(%esp)
c0105aff:	00 
c0105b00:	8b 55 e0             	mov    -0x20(%ebp),%edx
c0105b03:	89 54 24 04          	mov    %edx,0x4(%esp)
c0105b07:	89 04 24             	mov    %eax,(%esp)
c0105b0a:	e8 21 f5 ff ff       	call   c0105030 <page_insert>
c0105b0f:	85 c0                	test   %eax,%eax
c0105b11:	74 24                	je     c0105b37 <check_boot_pgdir+0x26d>
c0105b13:	c7 44 24 0c dc 9c 10 	movl   $0xc0109cdc,0xc(%esp)
c0105b1a:	c0 
c0105b1b:	c7 44 24 08 09 99 10 	movl   $0xc0109909,0x8(%esp)
c0105b22:	c0 
c0105b23:	c7 44 24 04 5c 02 00 	movl   $0x25c,0x4(%esp)
c0105b2a:	00 
c0105b2b:	c7 04 24 e4 98 10 c0 	movl   $0xc01098e4,(%esp)
c0105b32:	e8 9e b1 ff ff       	call   c0100cd5 <__panic>
    assert(page_ref(p) == 2);
c0105b37:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0105b3a:	89 04 24             	mov    %eax,(%esp)
c0105b3d:	e8 51 e9 ff ff       	call   c0104493 <page_ref>
c0105b42:	83 f8 02             	cmp    $0x2,%eax
c0105b45:	74 24                	je     c0105b6b <check_boot_pgdir+0x2a1>
c0105b47:	c7 44 24 0c 13 9d 10 	movl   $0xc0109d13,0xc(%esp)
c0105b4e:	c0 
c0105b4f:	c7 44 24 08 09 99 10 	movl   $0xc0109909,0x8(%esp)
c0105b56:	c0 
c0105b57:	c7 44 24 04 5d 02 00 	movl   $0x25d,0x4(%esp)
c0105b5e:	00 
c0105b5f:	c7 04 24 e4 98 10 c0 	movl   $0xc01098e4,(%esp)
c0105b66:	e8 6a b1 ff ff       	call   c0100cd5 <__panic>

    const char *str = "ucore: Hello world!!";
c0105b6b:	c7 45 dc 24 9d 10 c0 	movl   $0xc0109d24,-0x24(%ebp)
    strcpy((void *)0x100, str);
c0105b72:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0105b75:	89 44 24 04          	mov    %eax,0x4(%esp)
c0105b79:	c7 04 24 00 01 00 00 	movl   $0x100,(%esp)
c0105b80:	e8 03 2c 00 00       	call   c0108788 <strcpy>
    assert(strcmp((void *)0x100, (void *)(0x100 + PGSIZE)) == 0);
c0105b85:	c7 44 24 04 00 11 00 	movl   $0x1100,0x4(%esp)
c0105b8c:	00 
c0105b8d:	c7 04 24 00 01 00 00 	movl   $0x100,(%esp)
c0105b94:	e8 68 2c 00 00       	call   c0108801 <strcmp>
c0105b99:	85 c0                	test   %eax,%eax
c0105b9b:	74 24                	je     c0105bc1 <check_boot_pgdir+0x2f7>
c0105b9d:	c7 44 24 0c 3c 9d 10 	movl   $0xc0109d3c,0xc(%esp)
c0105ba4:	c0 
c0105ba5:	c7 44 24 08 09 99 10 	movl   $0xc0109909,0x8(%esp)
c0105bac:	c0 
c0105bad:	c7 44 24 04 61 02 00 	movl   $0x261,0x4(%esp)
c0105bb4:	00 
c0105bb5:	c7 04 24 e4 98 10 c0 	movl   $0xc01098e4,(%esp)
c0105bbc:	e8 14 b1 ff ff       	call   c0100cd5 <__panic>

    *(char *)(page2kva(p) + 0x100) = '\0';
c0105bc1:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0105bc4:	89 04 24             	mov    %eax,(%esp)
c0105bc7:	e8 eb e7 ff ff       	call   c01043b7 <page2kva>
c0105bcc:	05 00 01 00 00       	add    $0x100,%eax
c0105bd1:	c6 00 00             	movb   $0x0,(%eax)
    assert(strlen((const char *)0x100) == 0);
c0105bd4:	c7 04 24 00 01 00 00 	movl   $0x100,(%esp)
c0105bdb:	e8 50 2b 00 00       	call   c0108730 <strlen>
c0105be0:	85 c0                	test   %eax,%eax
c0105be2:	74 24                	je     c0105c08 <check_boot_pgdir+0x33e>
c0105be4:	c7 44 24 0c 74 9d 10 	movl   $0xc0109d74,0xc(%esp)
c0105beb:	c0 
c0105bec:	c7 44 24 08 09 99 10 	movl   $0xc0109909,0x8(%esp)
c0105bf3:	c0 
c0105bf4:	c7 44 24 04 64 02 00 	movl   $0x264,0x4(%esp)
c0105bfb:	00 
c0105bfc:	c7 04 24 e4 98 10 c0 	movl   $0xc01098e4,(%esp)
c0105c03:	e8 cd b0 ff ff       	call   c0100cd5 <__panic>

    free_page(p);
c0105c08:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c0105c0f:	00 
c0105c10:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0105c13:	89 04 24             	mov    %eax,(%esp)
c0105c16:	e8 e8 ea ff ff       	call   c0104703 <free_pages>
    free_page(pa2page(PDE_ADDR(boot_pgdir[0])));
c0105c1b:	a1 24 1a 12 c0       	mov    0xc0121a24,%eax
c0105c20:	8b 00                	mov    (%eax),%eax
c0105c22:	25 00 f0 ff ff       	and    $0xfffff000,%eax
c0105c27:	89 04 24             	mov    %eax,(%esp)
c0105c2a:	e8 43 e7 ff ff       	call   c0104372 <pa2page>
c0105c2f:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c0105c36:	00 
c0105c37:	89 04 24             	mov    %eax,(%esp)
c0105c3a:	e8 c4 ea ff ff       	call   c0104703 <free_pages>
    boot_pgdir[0] = 0;
c0105c3f:	a1 24 1a 12 c0       	mov    0xc0121a24,%eax
c0105c44:	c7 00 00 00 00 00    	movl   $0x0,(%eax)

    cprintf("check_boot_pgdir() succeeded!\n");
c0105c4a:	c7 04 24 98 9d 10 c0 	movl   $0xc0109d98,(%esp)
c0105c51:	e8 f5 a6 ff ff       	call   c010034b <cprintf>
}
c0105c56:	c9                   	leave  
c0105c57:	c3                   	ret    

c0105c58 <perm2str>:

//perm2str - use string 'u,r,w,-' to present the permission
static const char *
perm2str(int perm) {
c0105c58:	55                   	push   %ebp
c0105c59:	89 e5                	mov    %esp,%ebp
    static char str[4];
    str[0] = (perm & PTE_U) ? 'u' : '-';
c0105c5b:	8b 45 08             	mov    0x8(%ebp),%eax
c0105c5e:	83 e0 04             	and    $0x4,%eax
c0105c61:	85 c0                	test   %eax,%eax
c0105c63:	74 07                	je     c0105c6c <perm2str+0x14>
c0105c65:	b8 75 00 00 00       	mov    $0x75,%eax
c0105c6a:	eb 05                	jmp    c0105c71 <perm2str+0x19>
c0105c6c:	b8 2d 00 00 00       	mov    $0x2d,%eax
c0105c71:	a2 a8 1a 12 c0       	mov    %al,0xc0121aa8
    str[1] = 'r';
c0105c76:	c6 05 a9 1a 12 c0 72 	movb   $0x72,0xc0121aa9
    str[2] = (perm & PTE_W) ? 'w' : '-';
c0105c7d:	8b 45 08             	mov    0x8(%ebp),%eax
c0105c80:	83 e0 02             	and    $0x2,%eax
c0105c83:	85 c0                	test   %eax,%eax
c0105c85:	74 07                	je     c0105c8e <perm2str+0x36>
c0105c87:	b8 77 00 00 00       	mov    $0x77,%eax
c0105c8c:	eb 05                	jmp    c0105c93 <perm2str+0x3b>
c0105c8e:	b8 2d 00 00 00       	mov    $0x2d,%eax
c0105c93:	a2 aa 1a 12 c0       	mov    %al,0xc0121aaa
    str[3] = '\0';
c0105c98:	c6 05 ab 1a 12 c0 00 	movb   $0x0,0xc0121aab
    return str;
c0105c9f:	b8 a8 1a 12 c0       	mov    $0xc0121aa8,%eax
}
c0105ca4:	5d                   	pop    %ebp
c0105ca5:	c3                   	ret    

c0105ca6 <get_pgtable_items>:
//  table:       the beginning addr of table
//  left_store:  the pointer of the high side of table's next range
//  right_store: the pointer of the low side of table's next range
// return value: 0 - not a invalid item range, perm - a valid item range with perm permission 
static int
get_pgtable_items(size_t left, size_t right, size_t start, uintptr_t *table, size_t *left_store, size_t *right_store) {
c0105ca6:	55                   	push   %ebp
c0105ca7:	89 e5                	mov    %esp,%ebp
c0105ca9:	83 ec 10             	sub    $0x10,%esp
    if (start >= right) {
c0105cac:	8b 45 10             	mov    0x10(%ebp),%eax
c0105caf:	3b 45 0c             	cmp    0xc(%ebp),%eax
c0105cb2:	72 0a                	jb     c0105cbe <get_pgtable_items+0x18>
        return 0;
c0105cb4:	b8 00 00 00 00       	mov    $0x0,%eax
c0105cb9:	e9 9c 00 00 00       	jmp    c0105d5a <get_pgtable_items+0xb4>
    }
    while (start < right && !(table[start] & PTE_P)) {
c0105cbe:	eb 04                	jmp    c0105cc4 <get_pgtable_items+0x1e>
        start ++;
c0105cc0:	83 45 10 01          	addl   $0x1,0x10(%ebp)
static int
get_pgtable_items(size_t left, size_t right, size_t start, uintptr_t *table, size_t *left_store, size_t *right_store) {
    if (start >= right) {
        return 0;
    }
    while (start < right && !(table[start] & PTE_P)) {
c0105cc4:	8b 45 10             	mov    0x10(%ebp),%eax
c0105cc7:	3b 45 0c             	cmp    0xc(%ebp),%eax
c0105cca:	73 18                	jae    c0105ce4 <get_pgtable_items+0x3e>
c0105ccc:	8b 45 10             	mov    0x10(%ebp),%eax
c0105ccf:	8d 14 85 00 00 00 00 	lea    0x0(,%eax,4),%edx
c0105cd6:	8b 45 14             	mov    0x14(%ebp),%eax
c0105cd9:	01 d0                	add    %edx,%eax
c0105cdb:	8b 00                	mov    (%eax),%eax
c0105cdd:	83 e0 01             	and    $0x1,%eax
c0105ce0:	85 c0                	test   %eax,%eax
c0105ce2:	74 dc                	je     c0105cc0 <get_pgtable_items+0x1a>
        start ++;
    }
    if (start < right) {
c0105ce4:	8b 45 10             	mov    0x10(%ebp),%eax
c0105ce7:	3b 45 0c             	cmp    0xc(%ebp),%eax
c0105cea:	73 69                	jae    c0105d55 <get_pgtable_items+0xaf>
        if (left_store != NULL) {
c0105cec:	83 7d 18 00          	cmpl   $0x0,0x18(%ebp)
c0105cf0:	74 08                	je     c0105cfa <get_pgtable_items+0x54>
            *left_store = start;
c0105cf2:	8b 45 18             	mov    0x18(%ebp),%eax
c0105cf5:	8b 55 10             	mov    0x10(%ebp),%edx
c0105cf8:	89 10                	mov    %edx,(%eax)
        }
        int perm = (table[start ++] & PTE_USER);
c0105cfa:	8b 45 10             	mov    0x10(%ebp),%eax
c0105cfd:	8d 50 01             	lea    0x1(%eax),%edx
c0105d00:	89 55 10             	mov    %edx,0x10(%ebp)
c0105d03:	8d 14 85 00 00 00 00 	lea    0x0(,%eax,4),%edx
c0105d0a:	8b 45 14             	mov    0x14(%ebp),%eax
c0105d0d:	01 d0                	add    %edx,%eax
c0105d0f:	8b 00                	mov    (%eax),%eax
c0105d11:	83 e0 07             	and    $0x7,%eax
c0105d14:	89 45 fc             	mov    %eax,-0x4(%ebp)
        while (start < right && (table[start] & PTE_USER) == perm) {
c0105d17:	eb 04                	jmp    c0105d1d <get_pgtable_items+0x77>
            start ++;
c0105d19:	83 45 10 01          	addl   $0x1,0x10(%ebp)
    if (start < right) {
        if (left_store != NULL) {
            *left_store = start;
        }
        int perm = (table[start ++] & PTE_USER);
        while (start < right && (table[start] & PTE_USER) == perm) {
c0105d1d:	8b 45 10             	mov    0x10(%ebp),%eax
c0105d20:	3b 45 0c             	cmp    0xc(%ebp),%eax
c0105d23:	73 1d                	jae    c0105d42 <get_pgtable_items+0x9c>
c0105d25:	8b 45 10             	mov    0x10(%ebp),%eax
c0105d28:	8d 14 85 00 00 00 00 	lea    0x0(,%eax,4),%edx
c0105d2f:	8b 45 14             	mov    0x14(%ebp),%eax
c0105d32:	01 d0                	add    %edx,%eax
c0105d34:	8b 00                	mov    (%eax),%eax
c0105d36:	83 e0 07             	and    $0x7,%eax
c0105d39:	89 c2                	mov    %eax,%edx
c0105d3b:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0105d3e:	39 c2                	cmp    %eax,%edx
c0105d40:	74 d7                	je     c0105d19 <get_pgtable_items+0x73>
            start ++;
        }
        if (right_store != NULL) {
c0105d42:	83 7d 1c 00          	cmpl   $0x0,0x1c(%ebp)
c0105d46:	74 08                	je     c0105d50 <get_pgtable_items+0xaa>
            *right_store = start;
c0105d48:	8b 45 1c             	mov    0x1c(%ebp),%eax
c0105d4b:	8b 55 10             	mov    0x10(%ebp),%edx
c0105d4e:	89 10                	mov    %edx,(%eax)
        }
        return perm;
c0105d50:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0105d53:	eb 05                	jmp    c0105d5a <get_pgtable_items+0xb4>
    }
    return 0;
c0105d55:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0105d5a:	c9                   	leave  
c0105d5b:	c3                   	ret    

c0105d5c <print_pgdir>:

//print_pgdir - print the PDT&PT
void
print_pgdir(void) {
c0105d5c:	55                   	push   %ebp
c0105d5d:	89 e5                	mov    %esp,%ebp
c0105d5f:	57                   	push   %edi
c0105d60:	56                   	push   %esi
c0105d61:	53                   	push   %ebx
c0105d62:	83 ec 4c             	sub    $0x4c,%esp
    cprintf("-------------------- BEGIN --------------------\n");
c0105d65:	c7 04 24 b8 9d 10 c0 	movl   $0xc0109db8,(%esp)
c0105d6c:	e8 da a5 ff ff       	call   c010034b <cprintf>
    size_t left, right = 0, perm;
c0105d71:	c7 45 dc 00 00 00 00 	movl   $0x0,-0x24(%ebp)
    while ((perm = get_pgtable_items(0, NPDEENTRY, right, vpd, &left, &right)) != 0) {
c0105d78:	e9 fa 00 00 00       	jmp    c0105e77 <print_pgdir+0x11b>
        cprintf("PDE(%03x) %08x-%08x %08x %s\n", right - left,
c0105d7d:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0105d80:	89 04 24             	mov    %eax,(%esp)
c0105d83:	e8 d0 fe ff ff       	call   c0105c58 <perm2str>
                left * PTSIZE, right * PTSIZE, (right - left) * PTSIZE, perm2str(perm));
c0105d88:	8b 4d dc             	mov    -0x24(%ebp),%ecx
c0105d8b:	8b 55 e0             	mov    -0x20(%ebp),%edx
c0105d8e:	29 d1                	sub    %edx,%ecx
c0105d90:	89 ca                	mov    %ecx,%edx
void
print_pgdir(void) {
    cprintf("-------------------- BEGIN --------------------\n");
    size_t left, right = 0, perm;
    while ((perm = get_pgtable_items(0, NPDEENTRY, right, vpd, &left, &right)) != 0) {
        cprintf("PDE(%03x) %08x-%08x %08x %s\n", right - left,
c0105d92:	89 d6                	mov    %edx,%esi
c0105d94:	c1 e6 16             	shl    $0x16,%esi
c0105d97:	8b 55 dc             	mov    -0x24(%ebp),%edx
c0105d9a:	89 d3                	mov    %edx,%ebx
c0105d9c:	c1 e3 16             	shl    $0x16,%ebx
c0105d9f:	8b 55 e0             	mov    -0x20(%ebp),%edx
c0105da2:	89 d1                	mov    %edx,%ecx
c0105da4:	c1 e1 16             	shl    $0x16,%ecx
c0105da7:	8b 7d dc             	mov    -0x24(%ebp),%edi
c0105daa:	8b 55 e0             	mov    -0x20(%ebp),%edx
c0105dad:	29 d7                	sub    %edx,%edi
c0105daf:	89 fa                	mov    %edi,%edx
c0105db1:	89 44 24 14          	mov    %eax,0x14(%esp)
c0105db5:	89 74 24 10          	mov    %esi,0x10(%esp)
c0105db9:	89 5c 24 0c          	mov    %ebx,0xc(%esp)
c0105dbd:	89 4c 24 08          	mov    %ecx,0x8(%esp)
c0105dc1:	89 54 24 04          	mov    %edx,0x4(%esp)
c0105dc5:	c7 04 24 e9 9d 10 c0 	movl   $0xc0109de9,(%esp)
c0105dcc:	e8 7a a5 ff ff       	call   c010034b <cprintf>
                left * PTSIZE, right * PTSIZE, (right - left) * PTSIZE, perm2str(perm));
        size_t l, r = left * NPTEENTRY;
c0105dd1:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0105dd4:	c1 e0 0a             	shl    $0xa,%eax
c0105dd7:	89 45 d4             	mov    %eax,-0x2c(%ebp)
        while ((perm = get_pgtable_items(left * NPTEENTRY, right * NPTEENTRY, r, vpt, &l, &r)) != 0) {
c0105dda:	eb 54                	jmp    c0105e30 <print_pgdir+0xd4>
            cprintf("  |-- PTE(%05x) %08x-%08x %08x %s\n", r - l,
c0105ddc:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0105ddf:	89 04 24             	mov    %eax,(%esp)
c0105de2:	e8 71 fe ff ff       	call   c0105c58 <perm2str>
                    l * PGSIZE, r * PGSIZE, (r - l) * PGSIZE, perm2str(perm));
c0105de7:	8b 4d d4             	mov    -0x2c(%ebp),%ecx
c0105dea:	8b 55 d8             	mov    -0x28(%ebp),%edx
c0105ded:	29 d1                	sub    %edx,%ecx
c0105def:	89 ca                	mov    %ecx,%edx
    while ((perm = get_pgtable_items(0, NPDEENTRY, right, vpd, &left, &right)) != 0) {
        cprintf("PDE(%03x) %08x-%08x %08x %s\n", right - left,
                left * PTSIZE, right * PTSIZE, (right - left) * PTSIZE, perm2str(perm));
        size_t l, r = left * NPTEENTRY;
        while ((perm = get_pgtable_items(left * NPTEENTRY, right * NPTEENTRY, r, vpt, &l, &r)) != 0) {
            cprintf("  |-- PTE(%05x) %08x-%08x %08x %s\n", r - l,
c0105df1:	89 d6                	mov    %edx,%esi
c0105df3:	c1 e6 0c             	shl    $0xc,%esi
c0105df6:	8b 55 d4             	mov    -0x2c(%ebp),%edx
c0105df9:	89 d3                	mov    %edx,%ebx
c0105dfb:	c1 e3 0c             	shl    $0xc,%ebx
c0105dfe:	8b 55 d8             	mov    -0x28(%ebp),%edx
c0105e01:	c1 e2 0c             	shl    $0xc,%edx
c0105e04:	89 d1                	mov    %edx,%ecx
c0105e06:	8b 7d d4             	mov    -0x2c(%ebp),%edi
c0105e09:	8b 55 d8             	mov    -0x28(%ebp),%edx
c0105e0c:	29 d7                	sub    %edx,%edi
c0105e0e:	89 fa                	mov    %edi,%edx
c0105e10:	89 44 24 14          	mov    %eax,0x14(%esp)
c0105e14:	89 74 24 10          	mov    %esi,0x10(%esp)
c0105e18:	89 5c 24 0c          	mov    %ebx,0xc(%esp)
c0105e1c:	89 4c 24 08          	mov    %ecx,0x8(%esp)
c0105e20:	89 54 24 04          	mov    %edx,0x4(%esp)
c0105e24:	c7 04 24 08 9e 10 c0 	movl   $0xc0109e08,(%esp)
c0105e2b:	e8 1b a5 ff ff       	call   c010034b <cprintf>
    size_t left, right = 0, perm;
    while ((perm = get_pgtable_items(0, NPDEENTRY, right, vpd, &left, &right)) != 0) {
        cprintf("PDE(%03x) %08x-%08x %08x %s\n", right - left,
                left * PTSIZE, right * PTSIZE, (right - left) * PTSIZE, perm2str(perm));
        size_t l, r = left * NPTEENTRY;
        while ((perm = get_pgtable_items(left * NPTEENTRY, right * NPTEENTRY, r, vpt, &l, &r)) != 0) {
c0105e30:	ba 00 00 c0 fa       	mov    $0xfac00000,%edx
c0105e35:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c0105e38:	8b 4d dc             	mov    -0x24(%ebp),%ecx
c0105e3b:	89 ce                	mov    %ecx,%esi
c0105e3d:	c1 e6 0a             	shl    $0xa,%esi
c0105e40:	8b 4d e0             	mov    -0x20(%ebp),%ecx
c0105e43:	89 cb                	mov    %ecx,%ebx
c0105e45:	c1 e3 0a             	shl    $0xa,%ebx
c0105e48:	8d 4d d4             	lea    -0x2c(%ebp),%ecx
c0105e4b:	89 4c 24 14          	mov    %ecx,0x14(%esp)
c0105e4f:	8d 4d d8             	lea    -0x28(%ebp),%ecx
c0105e52:	89 4c 24 10          	mov    %ecx,0x10(%esp)
c0105e56:	89 54 24 0c          	mov    %edx,0xc(%esp)
c0105e5a:	89 44 24 08          	mov    %eax,0x8(%esp)
c0105e5e:	89 74 24 04          	mov    %esi,0x4(%esp)
c0105e62:	89 1c 24             	mov    %ebx,(%esp)
c0105e65:	e8 3c fe ff ff       	call   c0105ca6 <get_pgtable_items>
c0105e6a:	89 45 e4             	mov    %eax,-0x1c(%ebp)
c0105e6d:	83 7d e4 00          	cmpl   $0x0,-0x1c(%ebp)
c0105e71:	0f 85 65 ff ff ff    	jne    c0105ddc <print_pgdir+0x80>
//print_pgdir - print the PDT&PT
void
print_pgdir(void) {
    cprintf("-------------------- BEGIN --------------------\n");
    size_t left, right = 0, perm;
    while ((perm = get_pgtable_items(0, NPDEENTRY, right, vpd, &left, &right)) != 0) {
c0105e77:	ba 00 b0 fe fa       	mov    $0xfafeb000,%edx
c0105e7c:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0105e7f:	8d 4d dc             	lea    -0x24(%ebp),%ecx
c0105e82:	89 4c 24 14          	mov    %ecx,0x14(%esp)
c0105e86:	8d 4d e0             	lea    -0x20(%ebp),%ecx
c0105e89:	89 4c 24 10          	mov    %ecx,0x10(%esp)
c0105e8d:	89 54 24 0c          	mov    %edx,0xc(%esp)
c0105e91:	89 44 24 08          	mov    %eax,0x8(%esp)
c0105e95:	c7 44 24 04 00 04 00 	movl   $0x400,0x4(%esp)
c0105e9c:	00 
c0105e9d:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
c0105ea4:	e8 fd fd ff ff       	call   c0105ca6 <get_pgtable_items>
c0105ea9:	89 45 e4             	mov    %eax,-0x1c(%ebp)
c0105eac:	83 7d e4 00          	cmpl   $0x0,-0x1c(%ebp)
c0105eb0:	0f 85 c7 fe ff ff    	jne    c0105d7d <print_pgdir+0x21>
        while ((perm = get_pgtable_items(left * NPTEENTRY, right * NPTEENTRY, r, vpt, &l, &r)) != 0) {
            cprintf("  |-- PTE(%05x) %08x-%08x %08x %s\n", r - l,
                    l * PGSIZE, r * PGSIZE, (r - l) * PGSIZE, perm2str(perm));
        }
    }
    cprintf("--------------------- END ---------------------\n");
c0105eb6:	c7 04 24 2c 9e 10 c0 	movl   $0xc0109e2c,(%esp)
c0105ebd:	e8 89 a4 ff ff       	call   c010034b <cprintf>
}
c0105ec2:	83 c4 4c             	add    $0x4c,%esp
c0105ec5:	5b                   	pop    %ebx
c0105ec6:	5e                   	pop    %esi
c0105ec7:	5f                   	pop    %edi
c0105ec8:	5d                   	pop    %ebp
c0105ec9:	c3                   	ret    

c0105eca <kmalloc>:

void *
kmalloc(size_t n) {
c0105eca:	55                   	push   %ebp
c0105ecb:	89 e5                	mov    %esp,%ebp
c0105ecd:	83 ec 28             	sub    $0x28,%esp
    void * ptr=NULL;
c0105ed0:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
    struct Page *base=NULL;
c0105ed7:	c7 45 f0 00 00 00 00 	movl   $0x0,-0x10(%ebp)
    assert(n > 0 && n < 1024*0124);
c0105ede:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
c0105ee2:	74 09                	je     c0105eed <kmalloc+0x23>
c0105ee4:	81 7d 08 ff 4f 01 00 	cmpl   $0x14fff,0x8(%ebp)
c0105eeb:	76 24                	jbe    c0105f11 <kmalloc+0x47>
c0105eed:	c7 44 24 0c 5d 9e 10 	movl   $0xc0109e5d,0xc(%esp)
c0105ef4:	c0 
c0105ef5:	c7 44 24 08 09 99 10 	movl   $0xc0109909,0x8(%esp)
c0105efc:	c0 
c0105efd:	c7 44 24 04 b0 02 00 	movl   $0x2b0,0x4(%esp)
c0105f04:	00 
c0105f05:	c7 04 24 e4 98 10 c0 	movl   $0xc01098e4,(%esp)
c0105f0c:	e8 c4 ad ff ff       	call   c0100cd5 <__panic>
    int num_pages=(n+PGSIZE-1)/PGSIZE;
c0105f11:	8b 45 08             	mov    0x8(%ebp),%eax
c0105f14:	05 ff 0f 00 00       	add    $0xfff,%eax
c0105f19:	c1 e8 0c             	shr    $0xc,%eax
c0105f1c:	89 45 ec             	mov    %eax,-0x14(%ebp)
    base = alloc_pages(num_pages);
c0105f1f:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0105f22:	89 04 24             	mov    %eax,(%esp)
c0105f25:	e8 6e e7 ff ff       	call   c0104698 <alloc_pages>
c0105f2a:	89 45 f0             	mov    %eax,-0x10(%ebp)
    assert(base != NULL);
c0105f2d:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c0105f31:	75 24                	jne    c0105f57 <kmalloc+0x8d>
c0105f33:	c7 44 24 0c 74 9e 10 	movl   $0xc0109e74,0xc(%esp)
c0105f3a:	c0 
c0105f3b:	c7 44 24 08 09 99 10 	movl   $0xc0109909,0x8(%esp)
c0105f42:	c0 
c0105f43:	c7 44 24 04 b3 02 00 	movl   $0x2b3,0x4(%esp)
c0105f4a:	00 
c0105f4b:	c7 04 24 e4 98 10 c0 	movl   $0xc01098e4,(%esp)
c0105f52:	e8 7e ad ff ff       	call   c0100cd5 <__panic>
    ptr=page2kva(base);
c0105f57:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0105f5a:	89 04 24             	mov    %eax,(%esp)
c0105f5d:	e8 55 e4 ff ff       	call   c01043b7 <page2kva>
c0105f62:	89 45 f4             	mov    %eax,-0xc(%ebp)
    return ptr;
c0105f65:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c0105f68:	c9                   	leave  
c0105f69:	c3                   	ret    

c0105f6a <kfree>:

void 
kfree(void *ptr, size_t n) {
c0105f6a:	55                   	push   %ebp
c0105f6b:	89 e5                	mov    %esp,%ebp
c0105f6d:	83 ec 28             	sub    $0x28,%esp
    assert(n > 0 && n < 1024*0124);
c0105f70:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
c0105f74:	74 09                	je     c0105f7f <kfree+0x15>
c0105f76:	81 7d 0c ff 4f 01 00 	cmpl   $0x14fff,0xc(%ebp)
c0105f7d:	76 24                	jbe    c0105fa3 <kfree+0x39>
c0105f7f:	c7 44 24 0c 5d 9e 10 	movl   $0xc0109e5d,0xc(%esp)
c0105f86:	c0 
c0105f87:	c7 44 24 08 09 99 10 	movl   $0xc0109909,0x8(%esp)
c0105f8e:	c0 
c0105f8f:	c7 44 24 04 ba 02 00 	movl   $0x2ba,0x4(%esp)
c0105f96:	00 
c0105f97:	c7 04 24 e4 98 10 c0 	movl   $0xc01098e4,(%esp)
c0105f9e:	e8 32 ad ff ff       	call   c0100cd5 <__panic>
    assert(ptr != NULL);
c0105fa3:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
c0105fa7:	75 24                	jne    c0105fcd <kfree+0x63>
c0105fa9:	c7 44 24 0c 81 9e 10 	movl   $0xc0109e81,0xc(%esp)
c0105fb0:	c0 
c0105fb1:	c7 44 24 08 09 99 10 	movl   $0xc0109909,0x8(%esp)
c0105fb8:	c0 
c0105fb9:	c7 44 24 04 bb 02 00 	movl   $0x2bb,0x4(%esp)
c0105fc0:	00 
c0105fc1:	c7 04 24 e4 98 10 c0 	movl   $0xc01098e4,(%esp)
c0105fc8:	e8 08 ad ff ff       	call   c0100cd5 <__panic>
    struct Page *base=NULL;
c0105fcd:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
    int num_pages=(n+PGSIZE-1)/PGSIZE;
c0105fd4:	8b 45 0c             	mov    0xc(%ebp),%eax
c0105fd7:	05 ff 0f 00 00       	add    $0xfff,%eax
c0105fdc:	c1 e8 0c             	shr    $0xc,%eax
c0105fdf:	89 45 f0             	mov    %eax,-0x10(%ebp)
    base = kva2page(ptr);
c0105fe2:	8b 45 08             	mov    0x8(%ebp),%eax
c0105fe5:	89 04 24             	mov    %eax,(%esp)
c0105fe8:	e8 1e e4 ff ff       	call   c010440b <kva2page>
c0105fed:	89 45 f4             	mov    %eax,-0xc(%ebp)
    free_pages(base, num_pages);
c0105ff0:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0105ff3:	89 44 24 04          	mov    %eax,0x4(%esp)
c0105ff7:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105ffa:	89 04 24             	mov    %eax,(%esp)
c0105ffd:	e8 01 e7 ff ff       	call   c0104703 <free_pages>
}
c0106002:	c9                   	leave  
c0106003:	c3                   	ret    

c0106004 <pa2page>:
page2pa(struct Page *page) {
    return page2ppn(page) << PGSHIFT;
}

static inline struct Page *
pa2page(uintptr_t pa) {
c0106004:	55                   	push   %ebp
c0106005:	89 e5                	mov    %esp,%ebp
c0106007:	83 ec 18             	sub    $0x18,%esp
    if (PPN(pa) >= npage) {
c010600a:	8b 45 08             	mov    0x8(%ebp),%eax
c010600d:	c1 e8 0c             	shr    $0xc,%eax
c0106010:	89 c2                	mov    %eax,%edx
c0106012:	a1 20 1a 12 c0       	mov    0xc0121a20,%eax
c0106017:	39 c2                	cmp    %eax,%edx
c0106019:	72 1c                	jb     c0106037 <pa2page+0x33>
        panic("pa2page called with invalid pa");
c010601b:	c7 44 24 08 90 9e 10 	movl   $0xc0109e90,0x8(%esp)
c0106022:	c0 
c0106023:	c7 44 24 04 5b 00 00 	movl   $0x5b,0x4(%esp)
c010602a:	00 
c010602b:	c7 04 24 af 9e 10 c0 	movl   $0xc0109eaf,(%esp)
c0106032:	e8 9e ac ff ff       	call   c0100cd5 <__panic>
    }
    return &pages[PPN(pa)];
c0106037:	a1 d4 1a 12 c0       	mov    0xc0121ad4,%eax
c010603c:	8b 55 08             	mov    0x8(%ebp),%edx
c010603f:	c1 ea 0c             	shr    $0xc,%edx
c0106042:	c1 e2 05             	shl    $0x5,%edx
c0106045:	01 d0                	add    %edx,%eax
}
c0106047:	c9                   	leave  
c0106048:	c3                   	ret    

c0106049 <pte2page>:
kva2page(void *kva) {
    return pa2page(PADDR(kva));
}

static inline struct Page *
pte2page(pte_t pte) {
c0106049:	55                   	push   %ebp
c010604a:	89 e5                	mov    %esp,%ebp
c010604c:	83 ec 18             	sub    $0x18,%esp
    if (!(pte & PTE_P)) {
c010604f:	8b 45 08             	mov    0x8(%ebp),%eax
c0106052:	83 e0 01             	and    $0x1,%eax
c0106055:	85 c0                	test   %eax,%eax
c0106057:	75 1c                	jne    c0106075 <pte2page+0x2c>
        panic("pte2page called with invalid pte");
c0106059:	c7 44 24 08 c0 9e 10 	movl   $0xc0109ec0,0x8(%esp)
c0106060:	c0 
c0106061:	c7 44 24 04 6d 00 00 	movl   $0x6d,0x4(%esp)
c0106068:	00 
c0106069:	c7 04 24 af 9e 10 c0 	movl   $0xc0109eaf,(%esp)
c0106070:	e8 60 ac ff ff       	call   c0100cd5 <__panic>
    }
    return pa2page(PTE_ADDR(pte));
c0106075:	8b 45 08             	mov    0x8(%ebp),%eax
c0106078:	25 00 f0 ff ff       	and    $0xfffff000,%eax
c010607d:	89 04 24             	mov    %eax,(%esp)
c0106080:	e8 7f ff ff ff       	call   c0106004 <pa2page>
}
c0106085:	c9                   	leave  
c0106086:	c3                   	ret    

c0106087 <swap_init>:

static void check_swap(void);

int
swap_init(void)
{
c0106087:	55                   	push   %ebp
c0106088:	89 e5                	mov    %esp,%ebp
c010608a:	83 ec 28             	sub    $0x28,%esp
     swapfs_init();
c010608d:	e8 19 1e 00 00       	call   c0107eab <swapfs_init>

     if (!(1024 <= max_swap_offset && max_swap_offset < MAX_SWAP_OFFSET_LIMIT))
c0106092:	a1 7c 1b 12 c0       	mov    0xc0121b7c,%eax
c0106097:	3d ff 03 00 00       	cmp    $0x3ff,%eax
c010609c:	76 0c                	jbe    c01060aa <swap_init+0x23>
c010609e:	a1 7c 1b 12 c0       	mov    0xc0121b7c,%eax
c01060a3:	3d ff ff ff 00       	cmp    $0xffffff,%eax
c01060a8:	76 25                	jbe    c01060cf <swap_init+0x48>
     {
          panic("bad max_swap_offset %08x.\n", max_swap_offset);
c01060aa:	a1 7c 1b 12 c0       	mov    0xc0121b7c,%eax
c01060af:	89 44 24 0c          	mov    %eax,0xc(%esp)
c01060b3:	c7 44 24 08 e1 9e 10 	movl   $0xc0109ee1,0x8(%esp)
c01060ba:	c0 
c01060bb:	c7 44 24 04 25 00 00 	movl   $0x25,0x4(%esp)
c01060c2:	00 
c01060c3:	c7 04 24 fc 9e 10 c0 	movl   $0xc0109efc,(%esp)
c01060ca:	e8 06 ac ff ff       	call   c0100cd5 <__panic>
     }
     

     sm = &swap_manager_fifo;
c01060cf:	c7 05 b4 1a 12 c0 40 	movl   $0xc0120a40,0xc0121ab4
c01060d6:	0a 12 c0 
     int r = sm->init();
c01060d9:	a1 b4 1a 12 c0       	mov    0xc0121ab4,%eax
c01060de:	8b 40 04             	mov    0x4(%eax),%eax
c01060e1:	ff d0                	call   *%eax
c01060e3:	89 45 f4             	mov    %eax,-0xc(%ebp)
     
     if (r == 0)
c01060e6:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c01060ea:	75 26                	jne    c0106112 <swap_init+0x8b>
     {
          swap_init_ok = 1;
c01060ec:	c7 05 ac 1a 12 c0 01 	movl   $0x1,0xc0121aac
c01060f3:	00 00 00 
          cprintf("SWAP: manager = %s\n", sm->name);
c01060f6:	a1 b4 1a 12 c0       	mov    0xc0121ab4,%eax
c01060fb:	8b 00                	mov    (%eax),%eax
c01060fd:	89 44 24 04          	mov    %eax,0x4(%esp)
c0106101:	c7 04 24 0b 9f 10 c0 	movl   $0xc0109f0b,(%esp)
c0106108:	e8 3e a2 ff ff       	call   c010034b <cprintf>
          check_swap();
c010610d:	e8 a4 04 00 00       	call   c01065b6 <check_swap>
     }

     return r;
c0106112:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c0106115:	c9                   	leave  
c0106116:	c3                   	ret    

c0106117 <swap_init_mm>:

int
swap_init_mm(struct mm_struct *mm)
{
c0106117:	55                   	push   %ebp
c0106118:	89 e5                	mov    %esp,%ebp
c010611a:	83 ec 18             	sub    $0x18,%esp
     return sm->init_mm(mm);
c010611d:	a1 b4 1a 12 c0       	mov    0xc0121ab4,%eax
c0106122:	8b 40 08             	mov    0x8(%eax),%eax
c0106125:	8b 55 08             	mov    0x8(%ebp),%edx
c0106128:	89 14 24             	mov    %edx,(%esp)
c010612b:	ff d0                	call   *%eax
}
c010612d:	c9                   	leave  
c010612e:	c3                   	ret    

c010612f <swap_tick_event>:

int
swap_tick_event(struct mm_struct *mm)
{
c010612f:	55                   	push   %ebp
c0106130:	89 e5                	mov    %esp,%ebp
c0106132:	83 ec 18             	sub    $0x18,%esp
     return sm->tick_event(mm);
c0106135:	a1 b4 1a 12 c0       	mov    0xc0121ab4,%eax
c010613a:	8b 40 0c             	mov    0xc(%eax),%eax
c010613d:	8b 55 08             	mov    0x8(%ebp),%edx
c0106140:	89 14 24             	mov    %edx,(%esp)
c0106143:	ff d0                	call   *%eax
}
c0106145:	c9                   	leave  
c0106146:	c3                   	ret    

c0106147 <swap_map_swappable>:

int
swap_map_swappable(struct mm_struct *mm, uintptr_t addr, struct Page *page, int swap_in)
{
c0106147:	55                   	push   %ebp
c0106148:	89 e5                	mov    %esp,%ebp
c010614a:	83 ec 18             	sub    $0x18,%esp
     return sm->map_swappable(mm, addr, page, swap_in);
c010614d:	a1 b4 1a 12 c0       	mov    0xc0121ab4,%eax
c0106152:	8b 40 10             	mov    0x10(%eax),%eax
c0106155:	8b 55 14             	mov    0x14(%ebp),%edx
c0106158:	89 54 24 0c          	mov    %edx,0xc(%esp)
c010615c:	8b 55 10             	mov    0x10(%ebp),%edx
c010615f:	89 54 24 08          	mov    %edx,0x8(%esp)
c0106163:	8b 55 0c             	mov    0xc(%ebp),%edx
c0106166:	89 54 24 04          	mov    %edx,0x4(%esp)
c010616a:	8b 55 08             	mov    0x8(%ebp),%edx
c010616d:	89 14 24             	mov    %edx,(%esp)
c0106170:	ff d0                	call   *%eax
}
c0106172:	c9                   	leave  
c0106173:	c3                   	ret    

c0106174 <swap_set_unswappable>:

int
swap_set_unswappable(struct mm_struct *mm, uintptr_t addr)
{
c0106174:	55                   	push   %ebp
c0106175:	89 e5                	mov    %esp,%ebp
c0106177:	83 ec 18             	sub    $0x18,%esp
     return sm->set_unswappable(mm, addr);
c010617a:	a1 b4 1a 12 c0       	mov    0xc0121ab4,%eax
c010617f:	8b 40 14             	mov    0x14(%eax),%eax
c0106182:	8b 55 0c             	mov    0xc(%ebp),%edx
c0106185:	89 54 24 04          	mov    %edx,0x4(%esp)
c0106189:	8b 55 08             	mov    0x8(%ebp),%edx
c010618c:	89 14 24             	mov    %edx,(%esp)
c010618f:	ff d0                	call   *%eax
}
c0106191:	c9                   	leave  
c0106192:	c3                   	ret    

c0106193 <swap_out>:

volatile unsigned int swap_out_num=0;

int
swap_out(struct mm_struct *mm, int n, int in_tick)
{
c0106193:	55                   	push   %ebp
c0106194:	89 e5                	mov    %esp,%ebp
c0106196:	83 ec 38             	sub    $0x38,%esp
     int i;
     for (i = 0; i != n; ++ i)
c0106199:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
c01061a0:	e9 5a 01 00 00       	jmp    c01062ff <swap_out+0x16c>
     {
          uintptr_t v;
          //struct Page **ptr_page=NULL;
          struct Page *page;
          // cprintf("i %d, SWAP: call swap_out_victim\n",i);
          int r = sm->swap_out_victim(mm, &page, in_tick);
c01061a5:	a1 b4 1a 12 c0       	mov    0xc0121ab4,%eax
c01061aa:	8b 40 18             	mov    0x18(%eax),%eax
c01061ad:	8b 55 10             	mov    0x10(%ebp),%edx
c01061b0:	89 54 24 08          	mov    %edx,0x8(%esp)
c01061b4:	8d 55 e4             	lea    -0x1c(%ebp),%edx
c01061b7:	89 54 24 04          	mov    %edx,0x4(%esp)
c01061bb:	8b 55 08             	mov    0x8(%ebp),%edx
c01061be:	89 14 24             	mov    %edx,(%esp)
c01061c1:	ff d0                	call   *%eax
c01061c3:	89 45 f0             	mov    %eax,-0x10(%ebp)
          if (r != 0) {
c01061c6:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c01061ca:	74 18                	je     c01061e4 <swap_out+0x51>
                    cprintf("i %d, swap_out: call swap_out_victim failed\n",i);
c01061cc:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01061cf:	89 44 24 04          	mov    %eax,0x4(%esp)
c01061d3:	c7 04 24 20 9f 10 c0 	movl   $0xc0109f20,(%esp)
c01061da:	e8 6c a1 ff ff       	call   c010034b <cprintf>
c01061df:	e9 27 01 00 00       	jmp    c010630b <swap_out+0x178>
          }          
          //assert(!PageReserved(page));

          //cprintf("SWAP: choose victim page 0x%08x\n", page);
          
          v=page->pra_vaddr; 
c01061e4:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c01061e7:	8b 40 1c             	mov    0x1c(%eax),%eax
c01061ea:	89 45 ec             	mov    %eax,-0x14(%ebp)
          pte_t *ptep = get_pte(mm->pgdir, v, 0);
c01061ed:	8b 45 08             	mov    0x8(%ebp),%eax
c01061f0:	8b 40 0c             	mov    0xc(%eax),%eax
c01061f3:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c01061fa:	00 
c01061fb:	8b 55 ec             	mov    -0x14(%ebp),%edx
c01061fe:	89 54 24 04          	mov    %edx,0x4(%esp)
c0106202:	89 04 24             	mov    %eax,(%esp)
c0106205:	e8 f0 eb ff ff       	call   c0104dfa <get_pte>
c010620a:	89 45 e8             	mov    %eax,-0x18(%ebp)
          assert((*ptep & PTE_P) != 0);
c010620d:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0106210:	8b 00                	mov    (%eax),%eax
c0106212:	83 e0 01             	and    $0x1,%eax
c0106215:	85 c0                	test   %eax,%eax
c0106217:	75 24                	jne    c010623d <swap_out+0xaa>
c0106219:	c7 44 24 0c 4d 9f 10 	movl   $0xc0109f4d,0xc(%esp)
c0106220:	c0 
c0106221:	c7 44 24 08 62 9f 10 	movl   $0xc0109f62,0x8(%esp)
c0106228:	c0 
c0106229:	c7 44 24 04 65 00 00 	movl   $0x65,0x4(%esp)
c0106230:	00 
c0106231:	c7 04 24 fc 9e 10 c0 	movl   $0xc0109efc,(%esp)
c0106238:	e8 98 aa ff ff       	call   c0100cd5 <__panic>

          if (swapfs_write( (page->pra_vaddr/PGSIZE+1)<<8, page) != 0) {
c010623d:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0106240:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c0106243:	8b 52 1c             	mov    0x1c(%edx),%edx
c0106246:	c1 ea 0c             	shr    $0xc,%edx
c0106249:	83 c2 01             	add    $0x1,%edx
c010624c:	c1 e2 08             	shl    $0x8,%edx
c010624f:	89 44 24 04          	mov    %eax,0x4(%esp)
c0106253:	89 14 24             	mov    %edx,(%esp)
c0106256:	e8 0a 1d 00 00       	call   c0107f65 <swapfs_write>
c010625b:	85 c0                	test   %eax,%eax
c010625d:	74 34                	je     c0106293 <swap_out+0x100>
                    cprintf("SWAP: failed to save\n");
c010625f:	c7 04 24 77 9f 10 c0 	movl   $0xc0109f77,(%esp)
c0106266:	e8 e0 a0 ff ff       	call   c010034b <cprintf>
                    sm->map_swappable(mm, v, page, 0);
c010626b:	a1 b4 1a 12 c0       	mov    0xc0121ab4,%eax
c0106270:	8b 40 10             	mov    0x10(%eax),%eax
c0106273:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c0106276:	c7 44 24 0c 00 00 00 	movl   $0x0,0xc(%esp)
c010627d:	00 
c010627e:	89 54 24 08          	mov    %edx,0x8(%esp)
c0106282:	8b 55 ec             	mov    -0x14(%ebp),%edx
c0106285:	89 54 24 04          	mov    %edx,0x4(%esp)
c0106289:	8b 55 08             	mov    0x8(%ebp),%edx
c010628c:	89 14 24             	mov    %edx,(%esp)
c010628f:	ff d0                	call   *%eax
c0106291:	eb 68                	jmp    c01062fb <swap_out+0x168>
                    continue;
          }
          else {
                    cprintf("swap_out: i %d, store page in vaddr 0x%x to disk swap entry %d\n", i, v, page->pra_vaddr/PGSIZE+1);
c0106293:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0106296:	8b 40 1c             	mov    0x1c(%eax),%eax
c0106299:	c1 e8 0c             	shr    $0xc,%eax
c010629c:	83 c0 01             	add    $0x1,%eax
c010629f:	89 44 24 0c          	mov    %eax,0xc(%esp)
c01062a3:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01062a6:	89 44 24 08          	mov    %eax,0x8(%esp)
c01062aa:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01062ad:	89 44 24 04          	mov    %eax,0x4(%esp)
c01062b1:	c7 04 24 90 9f 10 c0 	movl   $0xc0109f90,(%esp)
c01062b8:	e8 8e a0 ff ff       	call   c010034b <cprintf>
                    *ptep = (page->pra_vaddr/PGSIZE+1)<<8;
c01062bd:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c01062c0:	8b 40 1c             	mov    0x1c(%eax),%eax
c01062c3:	c1 e8 0c             	shr    $0xc,%eax
c01062c6:	83 c0 01             	add    $0x1,%eax
c01062c9:	c1 e0 08             	shl    $0x8,%eax
c01062cc:	89 c2                	mov    %eax,%edx
c01062ce:	8b 45 e8             	mov    -0x18(%ebp),%eax
c01062d1:	89 10                	mov    %edx,(%eax)
                    free_page(page);
c01062d3:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c01062d6:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c01062dd:	00 
c01062de:	89 04 24             	mov    %eax,(%esp)
c01062e1:	e8 1d e4 ff ff       	call   c0104703 <free_pages>
          }
          
          tlb_invalidate(mm->pgdir, v);
c01062e6:	8b 45 08             	mov    0x8(%ebp),%eax
c01062e9:	8b 40 0c             	mov    0xc(%eax),%eax
c01062ec:	8b 55 ec             	mov    -0x14(%ebp),%edx
c01062ef:	89 54 24 04          	mov    %edx,0x4(%esp)
c01062f3:	89 04 24             	mov    %eax,(%esp)
c01062f6:	e8 ee ed ff ff       	call   c01050e9 <tlb_invalidate>

int
swap_out(struct mm_struct *mm, int n, int in_tick)
{
     int i;
     for (i = 0; i != n; ++ i)
c01062fb:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
c01062ff:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0106302:	3b 45 0c             	cmp    0xc(%ebp),%eax
c0106305:	0f 85 9a fe ff ff    	jne    c01061a5 <swap_out+0x12>
                    free_page(page);
          }
          
          tlb_invalidate(mm->pgdir, v);
     }
     return i;
c010630b:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c010630e:	c9                   	leave  
c010630f:	c3                   	ret    

c0106310 <swap_in>:

int
swap_in(struct mm_struct *mm, uintptr_t addr, struct Page **ptr_result)
{
c0106310:	55                   	push   %ebp
c0106311:	89 e5                	mov    %esp,%ebp
c0106313:	83 ec 28             	sub    $0x28,%esp
     struct Page *result = alloc_page();
c0106316:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c010631d:	e8 76 e3 ff ff       	call   c0104698 <alloc_pages>
c0106322:	89 45 f4             	mov    %eax,-0xc(%ebp)
     assert(result!=NULL);
c0106325:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0106329:	75 24                	jne    c010634f <swap_in+0x3f>
c010632b:	c7 44 24 0c d0 9f 10 	movl   $0xc0109fd0,0xc(%esp)
c0106332:	c0 
c0106333:	c7 44 24 08 62 9f 10 	movl   $0xc0109f62,0x8(%esp)
c010633a:	c0 
c010633b:	c7 44 24 04 7b 00 00 	movl   $0x7b,0x4(%esp)
c0106342:	00 
c0106343:	c7 04 24 fc 9e 10 c0 	movl   $0xc0109efc,(%esp)
c010634a:	e8 86 a9 ff ff       	call   c0100cd5 <__panic>

     pte_t *ptep = get_pte(mm->pgdir, addr, 0);
c010634f:	8b 45 08             	mov    0x8(%ebp),%eax
c0106352:	8b 40 0c             	mov    0xc(%eax),%eax
c0106355:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c010635c:	00 
c010635d:	8b 55 0c             	mov    0xc(%ebp),%edx
c0106360:	89 54 24 04          	mov    %edx,0x4(%esp)
c0106364:	89 04 24             	mov    %eax,(%esp)
c0106367:	e8 8e ea ff ff       	call   c0104dfa <get_pte>
c010636c:	89 45 f0             	mov    %eax,-0x10(%ebp)
     // cprintf("SWAP: load ptep %x swap entry %d to vaddr 0x%08x, page %x, No %d\n", ptep, (*ptep)>>8, addr, result, (result-pages));
    
     int r;
     if ((r = swapfs_read((*ptep), result)) != 0)
c010636f:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0106372:	8b 00                	mov    (%eax),%eax
c0106374:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0106377:	89 54 24 04          	mov    %edx,0x4(%esp)
c010637b:	89 04 24             	mov    %eax,(%esp)
c010637e:	e8 70 1b 00 00       	call   c0107ef3 <swapfs_read>
c0106383:	89 45 ec             	mov    %eax,-0x14(%ebp)
c0106386:	83 7d ec 00          	cmpl   $0x0,-0x14(%ebp)
c010638a:	74 2a                	je     c01063b6 <swap_in+0xa6>
     {
        assert(r!=0);
c010638c:	83 7d ec 00          	cmpl   $0x0,-0x14(%ebp)
c0106390:	75 24                	jne    c01063b6 <swap_in+0xa6>
c0106392:	c7 44 24 0c dd 9f 10 	movl   $0xc0109fdd,0xc(%esp)
c0106399:	c0 
c010639a:	c7 44 24 08 62 9f 10 	movl   $0xc0109f62,0x8(%esp)
c01063a1:	c0 
c01063a2:	c7 44 24 04 83 00 00 	movl   $0x83,0x4(%esp)
c01063a9:	00 
c01063aa:	c7 04 24 fc 9e 10 c0 	movl   $0xc0109efc,(%esp)
c01063b1:	e8 1f a9 ff ff       	call   c0100cd5 <__panic>
     }
     cprintf("swap_in: load disk swap entry %d with swap_page in vadr 0x%x\n", (*ptep)>>8, addr);
c01063b6:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01063b9:	8b 00                	mov    (%eax),%eax
c01063bb:	c1 e8 08             	shr    $0x8,%eax
c01063be:	89 c2                	mov    %eax,%edx
c01063c0:	8b 45 0c             	mov    0xc(%ebp),%eax
c01063c3:	89 44 24 08          	mov    %eax,0x8(%esp)
c01063c7:	89 54 24 04          	mov    %edx,0x4(%esp)
c01063cb:	c7 04 24 e4 9f 10 c0 	movl   $0xc0109fe4,(%esp)
c01063d2:	e8 74 9f ff ff       	call   c010034b <cprintf>
     *ptr_result=result;
c01063d7:	8b 45 10             	mov    0x10(%ebp),%eax
c01063da:	8b 55 f4             	mov    -0xc(%ebp),%edx
c01063dd:	89 10                	mov    %edx,(%eax)
     return 0;
c01063df:	b8 00 00 00 00       	mov    $0x0,%eax
}
c01063e4:	c9                   	leave  
c01063e5:	c3                   	ret    

c01063e6 <check_content_set>:



static inline void
check_content_set(void)
{
c01063e6:	55                   	push   %ebp
c01063e7:	89 e5                	mov    %esp,%ebp
c01063e9:	83 ec 18             	sub    $0x18,%esp
     *(unsigned char *)0x1000 = 0x0a;
c01063ec:	b8 00 10 00 00       	mov    $0x1000,%eax
c01063f1:	c6 00 0a             	movb   $0xa,(%eax)
     assert(pgfault_num==1);
c01063f4:	a1 b8 1a 12 c0       	mov    0xc0121ab8,%eax
c01063f9:	83 f8 01             	cmp    $0x1,%eax
c01063fc:	74 24                	je     c0106422 <check_content_set+0x3c>
c01063fe:	c7 44 24 0c 22 a0 10 	movl   $0xc010a022,0xc(%esp)
c0106405:	c0 
c0106406:	c7 44 24 08 62 9f 10 	movl   $0xc0109f62,0x8(%esp)
c010640d:	c0 
c010640e:	c7 44 24 04 90 00 00 	movl   $0x90,0x4(%esp)
c0106415:	00 
c0106416:	c7 04 24 fc 9e 10 c0 	movl   $0xc0109efc,(%esp)
c010641d:	e8 b3 a8 ff ff       	call   c0100cd5 <__panic>
     *(unsigned char *)0x1010 = 0x0a;
c0106422:	b8 10 10 00 00       	mov    $0x1010,%eax
c0106427:	c6 00 0a             	movb   $0xa,(%eax)
     assert(pgfault_num==1);
c010642a:	a1 b8 1a 12 c0       	mov    0xc0121ab8,%eax
c010642f:	83 f8 01             	cmp    $0x1,%eax
c0106432:	74 24                	je     c0106458 <check_content_set+0x72>
c0106434:	c7 44 24 0c 22 a0 10 	movl   $0xc010a022,0xc(%esp)
c010643b:	c0 
c010643c:	c7 44 24 08 62 9f 10 	movl   $0xc0109f62,0x8(%esp)
c0106443:	c0 
c0106444:	c7 44 24 04 92 00 00 	movl   $0x92,0x4(%esp)
c010644b:	00 
c010644c:	c7 04 24 fc 9e 10 c0 	movl   $0xc0109efc,(%esp)
c0106453:	e8 7d a8 ff ff       	call   c0100cd5 <__panic>
     *(unsigned char *)0x2000 = 0x0b;
c0106458:	b8 00 20 00 00       	mov    $0x2000,%eax
c010645d:	c6 00 0b             	movb   $0xb,(%eax)
     assert(pgfault_num==2);
c0106460:	a1 b8 1a 12 c0       	mov    0xc0121ab8,%eax
c0106465:	83 f8 02             	cmp    $0x2,%eax
c0106468:	74 24                	je     c010648e <check_content_set+0xa8>
c010646a:	c7 44 24 0c 31 a0 10 	movl   $0xc010a031,0xc(%esp)
c0106471:	c0 
c0106472:	c7 44 24 08 62 9f 10 	movl   $0xc0109f62,0x8(%esp)
c0106479:	c0 
c010647a:	c7 44 24 04 94 00 00 	movl   $0x94,0x4(%esp)
c0106481:	00 
c0106482:	c7 04 24 fc 9e 10 c0 	movl   $0xc0109efc,(%esp)
c0106489:	e8 47 a8 ff ff       	call   c0100cd5 <__panic>
     *(unsigned char *)0x2010 = 0x0b;
c010648e:	b8 10 20 00 00       	mov    $0x2010,%eax
c0106493:	c6 00 0b             	movb   $0xb,(%eax)
     assert(pgfault_num==2);
c0106496:	a1 b8 1a 12 c0       	mov    0xc0121ab8,%eax
c010649b:	83 f8 02             	cmp    $0x2,%eax
c010649e:	74 24                	je     c01064c4 <check_content_set+0xde>
c01064a0:	c7 44 24 0c 31 a0 10 	movl   $0xc010a031,0xc(%esp)
c01064a7:	c0 
c01064a8:	c7 44 24 08 62 9f 10 	movl   $0xc0109f62,0x8(%esp)
c01064af:	c0 
c01064b0:	c7 44 24 04 96 00 00 	movl   $0x96,0x4(%esp)
c01064b7:	00 
c01064b8:	c7 04 24 fc 9e 10 c0 	movl   $0xc0109efc,(%esp)
c01064bf:	e8 11 a8 ff ff       	call   c0100cd5 <__panic>
     *(unsigned char *)0x3000 = 0x0c;
c01064c4:	b8 00 30 00 00       	mov    $0x3000,%eax
c01064c9:	c6 00 0c             	movb   $0xc,(%eax)
     assert(pgfault_num==3);
c01064cc:	a1 b8 1a 12 c0       	mov    0xc0121ab8,%eax
c01064d1:	83 f8 03             	cmp    $0x3,%eax
c01064d4:	74 24                	je     c01064fa <check_content_set+0x114>
c01064d6:	c7 44 24 0c 40 a0 10 	movl   $0xc010a040,0xc(%esp)
c01064dd:	c0 
c01064de:	c7 44 24 08 62 9f 10 	movl   $0xc0109f62,0x8(%esp)
c01064e5:	c0 
c01064e6:	c7 44 24 04 98 00 00 	movl   $0x98,0x4(%esp)
c01064ed:	00 
c01064ee:	c7 04 24 fc 9e 10 c0 	movl   $0xc0109efc,(%esp)
c01064f5:	e8 db a7 ff ff       	call   c0100cd5 <__panic>
     *(unsigned char *)0x3010 = 0x0c;
c01064fa:	b8 10 30 00 00       	mov    $0x3010,%eax
c01064ff:	c6 00 0c             	movb   $0xc,(%eax)
     assert(pgfault_num==3);
c0106502:	a1 b8 1a 12 c0       	mov    0xc0121ab8,%eax
c0106507:	83 f8 03             	cmp    $0x3,%eax
c010650a:	74 24                	je     c0106530 <check_content_set+0x14a>
c010650c:	c7 44 24 0c 40 a0 10 	movl   $0xc010a040,0xc(%esp)
c0106513:	c0 
c0106514:	c7 44 24 08 62 9f 10 	movl   $0xc0109f62,0x8(%esp)
c010651b:	c0 
c010651c:	c7 44 24 04 9a 00 00 	movl   $0x9a,0x4(%esp)
c0106523:	00 
c0106524:	c7 04 24 fc 9e 10 c0 	movl   $0xc0109efc,(%esp)
c010652b:	e8 a5 a7 ff ff       	call   c0100cd5 <__panic>
     *(unsigned char *)0x4000 = 0x0d;
c0106530:	b8 00 40 00 00       	mov    $0x4000,%eax
c0106535:	c6 00 0d             	movb   $0xd,(%eax)
     assert(pgfault_num==4);
c0106538:	a1 b8 1a 12 c0       	mov    0xc0121ab8,%eax
c010653d:	83 f8 04             	cmp    $0x4,%eax
c0106540:	74 24                	je     c0106566 <check_content_set+0x180>
c0106542:	c7 44 24 0c 4f a0 10 	movl   $0xc010a04f,0xc(%esp)
c0106549:	c0 
c010654a:	c7 44 24 08 62 9f 10 	movl   $0xc0109f62,0x8(%esp)
c0106551:	c0 
c0106552:	c7 44 24 04 9c 00 00 	movl   $0x9c,0x4(%esp)
c0106559:	00 
c010655a:	c7 04 24 fc 9e 10 c0 	movl   $0xc0109efc,(%esp)
c0106561:	e8 6f a7 ff ff       	call   c0100cd5 <__panic>
     *(unsigned char *)0x4010 = 0x0d;
c0106566:	b8 10 40 00 00       	mov    $0x4010,%eax
c010656b:	c6 00 0d             	movb   $0xd,(%eax)
     assert(pgfault_num==4);
c010656e:	a1 b8 1a 12 c0       	mov    0xc0121ab8,%eax
c0106573:	83 f8 04             	cmp    $0x4,%eax
c0106576:	74 24                	je     c010659c <check_content_set+0x1b6>
c0106578:	c7 44 24 0c 4f a0 10 	movl   $0xc010a04f,0xc(%esp)
c010657f:	c0 
c0106580:	c7 44 24 08 62 9f 10 	movl   $0xc0109f62,0x8(%esp)
c0106587:	c0 
c0106588:	c7 44 24 04 9e 00 00 	movl   $0x9e,0x4(%esp)
c010658f:	00 
c0106590:	c7 04 24 fc 9e 10 c0 	movl   $0xc0109efc,(%esp)
c0106597:	e8 39 a7 ff ff       	call   c0100cd5 <__panic>
}
c010659c:	c9                   	leave  
c010659d:	c3                   	ret    

c010659e <check_content_access>:

static inline int
check_content_access(void)
{
c010659e:	55                   	push   %ebp
c010659f:	89 e5                	mov    %esp,%ebp
c01065a1:	83 ec 18             	sub    $0x18,%esp
    int ret = sm->check_swap();
c01065a4:	a1 b4 1a 12 c0       	mov    0xc0121ab4,%eax
c01065a9:	8b 40 1c             	mov    0x1c(%eax),%eax
c01065ac:	ff d0                	call   *%eax
c01065ae:	89 45 f4             	mov    %eax,-0xc(%ebp)
    return ret;
c01065b1:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c01065b4:	c9                   	leave  
c01065b5:	c3                   	ret    

c01065b6 <check_swap>:
#define free_list (free_area.free_list)
#define nr_free (free_area.nr_free)

static void
check_swap(void)
{
c01065b6:	55                   	push   %ebp
c01065b7:	89 e5                	mov    %esp,%ebp
c01065b9:	53                   	push   %ebx
c01065ba:	83 ec 74             	sub    $0x74,%esp
    //backup mem env
     int ret, count = 0, total = 0, i;
c01065bd:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
c01065c4:	c7 45 f0 00 00 00 00 	movl   $0x0,-0x10(%ebp)
     list_entry_t *le = &free_list;
c01065cb:	c7 45 e8 c0 1a 12 c0 	movl   $0xc0121ac0,-0x18(%ebp)
     while ((le = list_next(le)) != &free_list) {
c01065d2:	eb 6b                	jmp    c010663f <check_swap+0x89>
        struct Page *p = le2page(le, page_link);
c01065d4:	8b 45 e8             	mov    -0x18(%ebp),%eax
c01065d7:	83 e8 0c             	sub    $0xc,%eax
c01065da:	89 45 e4             	mov    %eax,-0x1c(%ebp)
        assert(PageProperty(p));
c01065dd:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c01065e0:	83 c0 04             	add    $0x4,%eax
c01065e3:	c7 45 c4 01 00 00 00 	movl   $0x1,-0x3c(%ebp)
c01065ea:	89 45 c0             	mov    %eax,-0x40(%ebp)
 * @addr:   the address to count from
 * */
static inline bool
test_bit(int nr, volatile void *addr) {
    int oldbit;
    asm volatile ("btl %2, %1; sbbl %0,%0" : "=r" (oldbit) : "m" (*(volatile long *)addr), "Ir" (nr));
c01065ed:	8b 45 c0             	mov    -0x40(%ebp),%eax
c01065f0:	8b 55 c4             	mov    -0x3c(%ebp),%edx
c01065f3:	0f a3 10             	bt     %edx,(%eax)
c01065f6:	19 c0                	sbb    %eax,%eax
c01065f8:	89 45 bc             	mov    %eax,-0x44(%ebp)
    return oldbit != 0;
c01065fb:	83 7d bc 00          	cmpl   $0x0,-0x44(%ebp)
c01065ff:	0f 95 c0             	setne  %al
c0106602:	0f b6 c0             	movzbl %al,%eax
c0106605:	85 c0                	test   %eax,%eax
c0106607:	75 24                	jne    c010662d <check_swap+0x77>
c0106609:	c7 44 24 0c 5e a0 10 	movl   $0xc010a05e,0xc(%esp)
c0106610:	c0 
c0106611:	c7 44 24 08 62 9f 10 	movl   $0xc0109f62,0x8(%esp)
c0106618:	c0 
c0106619:	c7 44 24 04 b9 00 00 	movl   $0xb9,0x4(%esp)
c0106620:	00 
c0106621:	c7 04 24 fc 9e 10 c0 	movl   $0xc0109efc,(%esp)
c0106628:	e8 a8 a6 ff ff       	call   c0100cd5 <__panic>
        count ++, total += p->property;
c010662d:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
c0106631:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0106634:	8b 50 08             	mov    0x8(%eax),%edx
c0106637:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010663a:	01 d0                	add    %edx,%eax
c010663c:	89 45 f0             	mov    %eax,-0x10(%ebp)
c010663f:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0106642:	89 45 b8             	mov    %eax,-0x48(%ebp)
c0106645:	8b 45 b8             	mov    -0x48(%ebp),%eax
c0106648:	8b 40 04             	mov    0x4(%eax),%eax
check_swap(void)
{
    //backup mem env
     int ret, count = 0, total = 0, i;
     list_entry_t *le = &free_list;
     while ((le = list_next(le)) != &free_list) {
c010664b:	89 45 e8             	mov    %eax,-0x18(%ebp)
c010664e:	81 7d e8 c0 1a 12 c0 	cmpl   $0xc0121ac0,-0x18(%ebp)
c0106655:	0f 85 79 ff ff ff    	jne    c01065d4 <check_swap+0x1e>
        struct Page *p = le2page(le, page_link);
        assert(PageProperty(p));
        count ++, total += p->property;
     }
     assert(total == nr_free_pages());
c010665b:	8b 5d f0             	mov    -0x10(%ebp),%ebx
c010665e:	e8 d2 e0 ff ff       	call   c0104735 <nr_free_pages>
c0106663:	39 c3                	cmp    %eax,%ebx
c0106665:	74 24                	je     c010668b <check_swap+0xd5>
c0106667:	c7 44 24 0c 6e a0 10 	movl   $0xc010a06e,0xc(%esp)
c010666e:	c0 
c010666f:	c7 44 24 08 62 9f 10 	movl   $0xc0109f62,0x8(%esp)
c0106676:	c0 
c0106677:	c7 44 24 04 bc 00 00 	movl   $0xbc,0x4(%esp)
c010667e:	00 
c010667f:	c7 04 24 fc 9e 10 c0 	movl   $0xc0109efc,(%esp)
c0106686:	e8 4a a6 ff ff       	call   c0100cd5 <__panic>
     cprintf("BEGIN check_swap: count %d, total %d\n",count,total);
c010668b:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010668e:	89 44 24 08          	mov    %eax,0x8(%esp)
c0106692:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0106695:	89 44 24 04          	mov    %eax,0x4(%esp)
c0106699:	c7 04 24 88 a0 10 c0 	movl   $0xc010a088,(%esp)
c01066a0:	e8 a6 9c ff ff       	call   c010034b <cprintf>
     
     //now we set the phy pages env     
     struct mm_struct *mm = mm_create();
c01066a5:	e8 47 0a 00 00       	call   c01070f1 <mm_create>
c01066aa:	89 45 e0             	mov    %eax,-0x20(%ebp)
     assert(mm != NULL);
c01066ad:	83 7d e0 00          	cmpl   $0x0,-0x20(%ebp)
c01066b1:	75 24                	jne    c01066d7 <check_swap+0x121>
c01066b3:	c7 44 24 0c ae a0 10 	movl   $0xc010a0ae,0xc(%esp)
c01066ba:	c0 
c01066bb:	c7 44 24 08 62 9f 10 	movl   $0xc0109f62,0x8(%esp)
c01066c2:	c0 
c01066c3:	c7 44 24 04 c1 00 00 	movl   $0xc1,0x4(%esp)
c01066ca:	00 
c01066cb:	c7 04 24 fc 9e 10 c0 	movl   $0xc0109efc,(%esp)
c01066d2:	e8 fe a5 ff ff       	call   c0100cd5 <__panic>

     extern struct mm_struct *check_mm_struct;
     assert(check_mm_struct == NULL);
c01066d7:	a1 ac 1b 12 c0       	mov    0xc0121bac,%eax
c01066dc:	85 c0                	test   %eax,%eax
c01066de:	74 24                	je     c0106704 <check_swap+0x14e>
c01066e0:	c7 44 24 0c b9 a0 10 	movl   $0xc010a0b9,0xc(%esp)
c01066e7:	c0 
c01066e8:	c7 44 24 08 62 9f 10 	movl   $0xc0109f62,0x8(%esp)
c01066ef:	c0 
c01066f0:	c7 44 24 04 c4 00 00 	movl   $0xc4,0x4(%esp)
c01066f7:	00 
c01066f8:	c7 04 24 fc 9e 10 c0 	movl   $0xc0109efc,(%esp)
c01066ff:	e8 d1 a5 ff ff       	call   c0100cd5 <__panic>

     check_mm_struct = mm;
c0106704:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0106707:	a3 ac 1b 12 c0       	mov    %eax,0xc0121bac

     pde_t *pgdir = mm->pgdir = boot_pgdir;
c010670c:	8b 15 24 1a 12 c0    	mov    0xc0121a24,%edx
c0106712:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0106715:	89 50 0c             	mov    %edx,0xc(%eax)
c0106718:	8b 45 e0             	mov    -0x20(%ebp),%eax
c010671b:	8b 40 0c             	mov    0xc(%eax),%eax
c010671e:	89 45 dc             	mov    %eax,-0x24(%ebp)
     assert(pgdir[0] == 0);
c0106721:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0106724:	8b 00                	mov    (%eax),%eax
c0106726:	85 c0                	test   %eax,%eax
c0106728:	74 24                	je     c010674e <check_swap+0x198>
c010672a:	c7 44 24 0c d1 a0 10 	movl   $0xc010a0d1,0xc(%esp)
c0106731:	c0 
c0106732:	c7 44 24 08 62 9f 10 	movl   $0xc0109f62,0x8(%esp)
c0106739:	c0 
c010673a:	c7 44 24 04 c9 00 00 	movl   $0xc9,0x4(%esp)
c0106741:	00 
c0106742:	c7 04 24 fc 9e 10 c0 	movl   $0xc0109efc,(%esp)
c0106749:	e8 87 a5 ff ff       	call   c0100cd5 <__panic>

     struct vma_struct *vma = vma_create(BEING_CHECK_VALID_VADDR, CHECK_VALID_VADDR, VM_WRITE | VM_READ);
c010674e:	c7 44 24 08 03 00 00 	movl   $0x3,0x8(%esp)
c0106755:	00 
c0106756:	c7 44 24 04 00 60 00 	movl   $0x6000,0x4(%esp)
c010675d:	00 
c010675e:	c7 04 24 00 10 00 00 	movl   $0x1000,(%esp)
c0106765:	e8 ff 09 00 00       	call   c0107169 <vma_create>
c010676a:	89 45 d8             	mov    %eax,-0x28(%ebp)
     assert(vma != NULL);
c010676d:	83 7d d8 00          	cmpl   $0x0,-0x28(%ebp)
c0106771:	75 24                	jne    c0106797 <check_swap+0x1e1>
c0106773:	c7 44 24 0c df a0 10 	movl   $0xc010a0df,0xc(%esp)
c010677a:	c0 
c010677b:	c7 44 24 08 62 9f 10 	movl   $0xc0109f62,0x8(%esp)
c0106782:	c0 
c0106783:	c7 44 24 04 cc 00 00 	movl   $0xcc,0x4(%esp)
c010678a:	00 
c010678b:	c7 04 24 fc 9e 10 c0 	movl   $0xc0109efc,(%esp)
c0106792:	e8 3e a5 ff ff       	call   c0100cd5 <__panic>

     insert_vma_struct(mm, vma);
c0106797:	8b 45 d8             	mov    -0x28(%ebp),%eax
c010679a:	89 44 24 04          	mov    %eax,0x4(%esp)
c010679e:	8b 45 e0             	mov    -0x20(%ebp),%eax
c01067a1:	89 04 24             	mov    %eax,(%esp)
c01067a4:	e8 50 0b 00 00       	call   c01072f9 <insert_vma_struct>

     //setup the temp Page Table vaddr 0~4MB
     cprintf("setup Page Table for vaddr 0X1000, so alloc a page\n");
c01067a9:	c7 04 24 ec a0 10 c0 	movl   $0xc010a0ec,(%esp)
c01067b0:	e8 96 9b ff ff       	call   c010034b <cprintf>
     pte_t *temp_ptep=NULL;
c01067b5:	c7 45 d4 00 00 00 00 	movl   $0x0,-0x2c(%ebp)
     temp_ptep = get_pte(mm->pgdir, BEING_CHECK_VALID_VADDR, 1);
c01067bc:	8b 45 e0             	mov    -0x20(%ebp),%eax
c01067bf:	8b 40 0c             	mov    0xc(%eax),%eax
c01067c2:	c7 44 24 08 01 00 00 	movl   $0x1,0x8(%esp)
c01067c9:	00 
c01067ca:	c7 44 24 04 00 10 00 	movl   $0x1000,0x4(%esp)
c01067d1:	00 
c01067d2:	89 04 24             	mov    %eax,(%esp)
c01067d5:	e8 20 e6 ff ff       	call   c0104dfa <get_pte>
c01067da:	89 45 d4             	mov    %eax,-0x2c(%ebp)
     assert(temp_ptep!= NULL);
c01067dd:	83 7d d4 00          	cmpl   $0x0,-0x2c(%ebp)
c01067e1:	75 24                	jne    c0106807 <check_swap+0x251>
c01067e3:	c7 44 24 0c 20 a1 10 	movl   $0xc010a120,0xc(%esp)
c01067ea:	c0 
c01067eb:	c7 44 24 08 62 9f 10 	movl   $0xc0109f62,0x8(%esp)
c01067f2:	c0 
c01067f3:	c7 44 24 04 d4 00 00 	movl   $0xd4,0x4(%esp)
c01067fa:	00 
c01067fb:	c7 04 24 fc 9e 10 c0 	movl   $0xc0109efc,(%esp)
c0106802:	e8 ce a4 ff ff       	call   c0100cd5 <__panic>
     cprintf("setup Page Table vaddr 0~4MB OVER!\n");
c0106807:	c7 04 24 34 a1 10 c0 	movl   $0xc010a134,(%esp)
c010680e:	e8 38 9b ff ff       	call   c010034b <cprintf>
     
     for (i=0;i<CHECK_VALID_PHY_PAGE_NUM;i++) {
c0106813:	c7 45 ec 00 00 00 00 	movl   $0x0,-0x14(%ebp)
c010681a:	e9 a3 00 00 00       	jmp    c01068c2 <check_swap+0x30c>
          check_rp[i] = alloc_page();
c010681f:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0106826:	e8 6d de ff ff       	call   c0104698 <alloc_pages>
c010682b:	8b 55 ec             	mov    -0x14(%ebp),%edx
c010682e:	89 04 95 e0 1a 12 c0 	mov    %eax,-0x3fede520(,%edx,4)
          assert(check_rp[i] != NULL );
c0106835:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0106838:	8b 04 85 e0 1a 12 c0 	mov    -0x3fede520(,%eax,4),%eax
c010683f:	85 c0                	test   %eax,%eax
c0106841:	75 24                	jne    c0106867 <check_swap+0x2b1>
c0106843:	c7 44 24 0c 58 a1 10 	movl   $0xc010a158,0xc(%esp)
c010684a:	c0 
c010684b:	c7 44 24 08 62 9f 10 	movl   $0xc0109f62,0x8(%esp)
c0106852:	c0 
c0106853:	c7 44 24 04 d9 00 00 	movl   $0xd9,0x4(%esp)
c010685a:	00 
c010685b:	c7 04 24 fc 9e 10 c0 	movl   $0xc0109efc,(%esp)
c0106862:	e8 6e a4 ff ff       	call   c0100cd5 <__panic>
          assert(!PageProperty(check_rp[i]));
c0106867:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010686a:	8b 04 85 e0 1a 12 c0 	mov    -0x3fede520(,%eax,4),%eax
c0106871:	83 c0 04             	add    $0x4,%eax
c0106874:	c7 45 b4 01 00 00 00 	movl   $0x1,-0x4c(%ebp)
c010687b:	89 45 b0             	mov    %eax,-0x50(%ebp)
 * @addr:   the address to count from
 * */
static inline bool
test_bit(int nr, volatile void *addr) {
    int oldbit;
    asm volatile ("btl %2, %1; sbbl %0,%0" : "=r" (oldbit) : "m" (*(volatile long *)addr), "Ir" (nr));
c010687e:	8b 45 b0             	mov    -0x50(%ebp),%eax
c0106881:	8b 55 b4             	mov    -0x4c(%ebp),%edx
c0106884:	0f a3 10             	bt     %edx,(%eax)
c0106887:	19 c0                	sbb    %eax,%eax
c0106889:	89 45 ac             	mov    %eax,-0x54(%ebp)
    return oldbit != 0;
c010688c:	83 7d ac 00          	cmpl   $0x0,-0x54(%ebp)
c0106890:	0f 95 c0             	setne  %al
c0106893:	0f b6 c0             	movzbl %al,%eax
c0106896:	85 c0                	test   %eax,%eax
c0106898:	74 24                	je     c01068be <check_swap+0x308>
c010689a:	c7 44 24 0c 6c a1 10 	movl   $0xc010a16c,0xc(%esp)
c01068a1:	c0 
c01068a2:	c7 44 24 08 62 9f 10 	movl   $0xc0109f62,0x8(%esp)
c01068a9:	c0 
c01068aa:	c7 44 24 04 da 00 00 	movl   $0xda,0x4(%esp)
c01068b1:	00 
c01068b2:	c7 04 24 fc 9e 10 c0 	movl   $0xc0109efc,(%esp)
c01068b9:	e8 17 a4 ff ff       	call   c0100cd5 <__panic>
     pte_t *temp_ptep=NULL;
     temp_ptep = get_pte(mm->pgdir, BEING_CHECK_VALID_VADDR, 1);
     assert(temp_ptep!= NULL);
     cprintf("setup Page Table vaddr 0~4MB OVER!\n");
     
     for (i=0;i<CHECK_VALID_PHY_PAGE_NUM;i++) {
c01068be:	83 45 ec 01          	addl   $0x1,-0x14(%ebp)
c01068c2:	83 7d ec 03          	cmpl   $0x3,-0x14(%ebp)
c01068c6:	0f 8e 53 ff ff ff    	jle    c010681f <check_swap+0x269>
          check_rp[i] = alloc_page();
          assert(check_rp[i] != NULL );
          assert(!PageProperty(check_rp[i]));
     }
     list_entry_t free_list_store = free_list;
c01068cc:	a1 c0 1a 12 c0       	mov    0xc0121ac0,%eax
c01068d1:	8b 15 c4 1a 12 c0    	mov    0xc0121ac4,%edx
c01068d7:	89 45 98             	mov    %eax,-0x68(%ebp)
c01068da:	89 55 9c             	mov    %edx,-0x64(%ebp)
c01068dd:	c7 45 a8 c0 1a 12 c0 	movl   $0xc0121ac0,-0x58(%ebp)
 * list_init - initialize a new entry
 * @elm:        new entry to be initialized
 * */
static inline void
list_init(list_entry_t *elm) {
    elm->prev = elm->next = elm;
c01068e4:	8b 45 a8             	mov    -0x58(%ebp),%eax
c01068e7:	8b 55 a8             	mov    -0x58(%ebp),%edx
c01068ea:	89 50 04             	mov    %edx,0x4(%eax)
c01068ed:	8b 45 a8             	mov    -0x58(%ebp),%eax
c01068f0:	8b 50 04             	mov    0x4(%eax),%edx
c01068f3:	8b 45 a8             	mov    -0x58(%ebp),%eax
c01068f6:	89 10                	mov    %edx,(%eax)
c01068f8:	c7 45 a4 c0 1a 12 c0 	movl   $0xc0121ac0,-0x5c(%ebp)
 * list_empty - tests whether a list is empty
 * @list:       the list to test.
 * */
static inline bool
list_empty(list_entry_t *list) {
    return list->next == list;
c01068ff:	8b 45 a4             	mov    -0x5c(%ebp),%eax
c0106902:	8b 40 04             	mov    0x4(%eax),%eax
c0106905:	39 45 a4             	cmp    %eax,-0x5c(%ebp)
c0106908:	0f 94 c0             	sete   %al
c010690b:	0f b6 c0             	movzbl %al,%eax
     list_init(&free_list);
     assert(list_empty(&free_list));
c010690e:	85 c0                	test   %eax,%eax
c0106910:	75 24                	jne    c0106936 <check_swap+0x380>
c0106912:	c7 44 24 0c 87 a1 10 	movl   $0xc010a187,0xc(%esp)
c0106919:	c0 
c010691a:	c7 44 24 08 62 9f 10 	movl   $0xc0109f62,0x8(%esp)
c0106921:	c0 
c0106922:	c7 44 24 04 de 00 00 	movl   $0xde,0x4(%esp)
c0106929:	00 
c010692a:	c7 04 24 fc 9e 10 c0 	movl   $0xc0109efc,(%esp)
c0106931:	e8 9f a3 ff ff       	call   c0100cd5 <__panic>
     
     //assert(alloc_page() == NULL);
     
     unsigned int nr_free_store = nr_free;
c0106936:	a1 c8 1a 12 c0       	mov    0xc0121ac8,%eax
c010693b:	89 45 d0             	mov    %eax,-0x30(%ebp)
     nr_free = 0;
c010693e:	c7 05 c8 1a 12 c0 00 	movl   $0x0,0xc0121ac8
c0106945:	00 00 00 
     for (i=0;i<CHECK_VALID_PHY_PAGE_NUM;i++) {
c0106948:	c7 45 ec 00 00 00 00 	movl   $0x0,-0x14(%ebp)
c010694f:	eb 1e                	jmp    c010696f <check_swap+0x3b9>
        free_pages(check_rp[i],1);
c0106951:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0106954:	8b 04 85 e0 1a 12 c0 	mov    -0x3fede520(,%eax,4),%eax
c010695b:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c0106962:	00 
c0106963:	89 04 24             	mov    %eax,(%esp)
c0106966:	e8 98 dd ff ff       	call   c0104703 <free_pages>
     
     //assert(alloc_page() == NULL);
     
     unsigned int nr_free_store = nr_free;
     nr_free = 0;
     for (i=0;i<CHECK_VALID_PHY_PAGE_NUM;i++) {
c010696b:	83 45 ec 01          	addl   $0x1,-0x14(%ebp)
c010696f:	83 7d ec 03          	cmpl   $0x3,-0x14(%ebp)
c0106973:	7e dc                	jle    c0106951 <check_swap+0x39b>
        free_pages(check_rp[i],1);
     }
     assert(nr_free==CHECK_VALID_PHY_PAGE_NUM);
c0106975:	a1 c8 1a 12 c0       	mov    0xc0121ac8,%eax
c010697a:	83 f8 04             	cmp    $0x4,%eax
c010697d:	74 24                	je     c01069a3 <check_swap+0x3ed>
c010697f:	c7 44 24 0c a0 a1 10 	movl   $0xc010a1a0,0xc(%esp)
c0106986:	c0 
c0106987:	c7 44 24 08 62 9f 10 	movl   $0xc0109f62,0x8(%esp)
c010698e:	c0 
c010698f:	c7 44 24 04 e7 00 00 	movl   $0xe7,0x4(%esp)
c0106996:	00 
c0106997:	c7 04 24 fc 9e 10 c0 	movl   $0xc0109efc,(%esp)
c010699e:	e8 32 a3 ff ff       	call   c0100cd5 <__panic>
     
     cprintf("set up init env for check_swap begin!\n");
c01069a3:	c7 04 24 c4 a1 10 c0 	movl   $0xc010a1c4,(%esp)
c01069aa:	e8 9c 99 ff ff       	call   c010034b <cprintf>
     //setup initial vir_page<->phy_page environment for page relpacement algorithm 

     
     pgfault_num=0;
c01069af:	c7 05 b8 1a 12 c0 00 	movl   $0x0,0xc0121ab8
c01069b6:	00 00 00 
     
     check_content_set();
c01069b9:	e8 28 fa ff ff       	call   c01063e6 <check_content_set>
     assert( nr_free == 0);         
c01069be:	a1 c8 1a 12 c0       	mov    0xc0121ac8,%eax
c01069c3:	85 c0                	test   %eax,%eax
c01069c5:	74 24                	je     c01069eb <check_swap+0x435>
c01069c7:	c7 44 24 0c eb a1 10 	movl   $0xc010a1eb,0xc(%esp)
c01069ce:	c0 
c01069cf:	c7 44 24 08 62 9f 10 	movl   $0xc0109f62,0x8(%esp)
c01069d6:	c0 
c01069d7:	c7 44 24 04 f0 00 00 	movl   $0xf0,0x4(%esp)
c01069de:	00 
c01069df:	c7 04 24 fc 9e 10 c0 	movl   $0xc0109efc,(%esp)
c01069e6:	e8 ea a2 ff ff       	call   c0100cd5 <__panic>
     for(i = 0; i<MAX_SEQ_NO ; i++) 
c01069eb:	c7 45 ec 00 00 00 00 	movl   $0x0,-0x14(%ebp)
c01069f2:	eb 26                	jmp    c0106a1a <check_swap+0x464>
         swap_out_seq_no[i]=swap_in_seq_no[i]=-1;
c01069f4:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01069f7:	c7 04 85 00 1b 12 c0 	movl   $0xffffffff,-0x3fede500(,%eax,4)
c01069fe:	ff ff ff ff 
c0106a02:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0106a05:	8b 14 85 00 1b 12 c0 	mov    -0x3fede500(,%eax,4),%edx
c0106a0c:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0106a0f:	89 14 85 40 1b 12 c0 	mov    %edx,-0x3fede4c0(,%eax,4)
     
     pgfault_num=0;
     
     check_content_set();
     assert( nr_free == 0);         
     for(i = 0; i<MAX_SEQ_NO ; i++) 
c0106a16:	83 45 ec 01          	addl   $0x1,-0x14(%ebp)
c0106a1a:	83 7d ec 09          	cmpl   $0x9,-0x14(%ebp)
c0106a1e:	7e d4                	jle    c01069f4 <check_swap+0x43e>
         swap_out_seq_no[i]=swap_in_seq_no[i]=-1;
     
     for (i= 0;i<CHECK_VALID_PHY_PAGE_NUM;i++) {
c0106a20:	c7 45 ec 00 00 00 00 	movl   $0x0,-0x14(%ebp)
c0106a27:	e9 eb 00 00 00       	jmp    c0106b17 <check_swap+0x561>
         check_ptep[i]=0;
c0106a2c:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0106a2f:	c7 04 85 94 1b 12 c0 	movl   $0x0,-0x3fede46c(,%eax,4)
c0106a36:	00 00 00 00 
         check_ptep[i] = get_pte(pgdir, (i+1)*0x1000, 0);
c0106a3a:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0106a3d:	83 c0 01             	add    $0x1,%eax
c0106a40:	c1 e0 0c             	shl    $0xc,%eax
c0106a43:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c0106a4a:	00 
c0106a4b:	89 44 24 04          	mov    %eax,0x4(%esp)
c0106a4f:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0106a52:	89 04 24             	mov    %eax,(%esp)
c0106a55:	e8 a0 e3 ff ff       	call   c0104dfa <get_pte>
c0106a5a:	8b 55 ec             	mov    -0x14(%ebp),%edx
c0106a5d:	89 04 95 94 1b 12 c0 	mov    %eax,-0x3fede46c(,%edx,4)
         //cprintf("i %d, check_ptep addr %x, value %x\n", i, check_ptep[i], *check_ptep[i]);
         assert(check_ptep[i] != NULL);
c0106a64:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0106a67:	8b 04 85 94 1b 12 c0 	mov    -0x3fede46c(,%eax,4),%eax
c0106a6e:	85 c0                	test   %eax,%eax
c0106a70:	75 24                	jne    c0106a96 <check_swap+0x4e0>
c0106a72:	c7 44 24 0c f8 a1 10 	movl   $0xc010a1f8,0xc(%esp)
c0106a79:	c0 
c0106a7a:	c7 44 24 08 62 9f 10 	movl   $0xc0109f62,0x8(%esp)
c0106a81:	c0 
c0106a82:	c7 44 24 04 f8 00 00 	movl   $0xf8,0x4(%esp)
c0106a89:	00 
c0106a8a:	c7 04 24 fc 9e 10 c0 	movl   $0xc0109efc,(%esp)
c0106a91:	e8 3f a2 ff ff       	call   c0100cd5 <__panic>
         assert(pte2page(*check_ptep[i]) == check_rp[i]);
c0106a96:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0106a99:	8b 04 85 94 1b 12 c0 	mov    -0x3fede46c(,%eax,4),%eax
c0106aa0:	8b 00                	mov    (%eax),%eax
c0106aa2:	89 04 24             	mov    %eax,(%esp)
c0106aa5:	e8 9f f5 ff ff       	call   c0106049 <pte2page>
c0106aaa:	8b 55 ec             	mov    -0x14(%ebp),%edx
c0106aad:	8b 14 95 e0 1a 12 c0 	mov    -0x3fede520(,%edx,4),%edx
c0106ab4:	39 d0                	cmp    %edx,%eax
c0106ab6:	74 24                	je     c0106adc <check_swap+0x526>
c0106ab8:	c7 44 24 0c 10 a2 10 	movl   $0xc010a210,0xc(%esp)
c0106abf:	c0 
c0106ac0:	c7 44 24 08 62 9f 10 	movl   $0xc0109f62,0x8(%esp)
c0106ac7:	c0 
c0106ac8:	c7 44 24 04 f9 00 00 	movl   $0xf9,0x4(%esp)
c0106acf:	00 
c0106ad0:	c7 04 24 fc 9e 10 c0 	movl   $0xc0109efc,(%esp)
c0106ad7:	e8 f9 a1 ff ff       	call   c0100cd5 <__panic>
         assert((*check_ptep[i] & PTE_P));          
c0106adc:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0106adf:	8b 04 85 94 1b 12 c0 	mov    -0x3fede46c(,%eax,4),%eax
c0106ae6:	8b 00                	mov    (%eax),%eax
c0106ae8:	83 e0 01             	and    $0x1,%eax
c0106aeb:	85 c0                	test   %eax,%eax
c0106aed:	75 24                	jne    c0106b13 <check_swap+0x55d>
c0106aef:	c7 44 24 0c 38 a2 10 	movl   $0xc010a238,0xc(%esp)
c0106af6:	c0 
c0106af7:	c7 44 24 08 62 9f 10 	movl   $0xc0109f62,0x8(%esp)
c0106afe:	c0 
c0106aff:	c7 44 24 04 fa 00 00 	movl   $0xfa,0x4(%esp)
c0106b06:	00 
c0106b07:	c7 04 24 fc 9e 10 c0 	movl   $0xc0109efc,(%esp)
c0106b0e:	e8 c2 a1 ff ff       	call   c0100cd5 <__panic>
     check_content_set();
     assert( nr_free == 0);         
     for(i = 0; i<MAX_SEQ_NO ; i++) 
         swap_out_seq_no[i]=swap_in_seq_no[i]=-1;
     
     for (i= 0;i<CHECK_VALID_PHY_PAGE_NUM;i++) {
c0106b13:	83 45 ec 01          	addl   $0x1,-0x14(%ebp)
c0106b17:	83 7d ec 03          	cmpl   $0x3,-0x14(%ebp)
c0106b1b:	0f 8e 0b ff ff ff    	jle    c0106a2c <check_swap+0x476>
         //cprintf("i %d, check_ptep addr %x, value %x\n", i, check_ptep[i], *check_ptep[i]);
         assert(check_ptep[i] != NULL);
         assert(pte2page(*check_ptep[i]) == check_rp[i]);
         assert((*check_ptep[i] & PTE_P));          
     }
     cprintf("set up init env for check_swap over!\n");
c0106b21:	c7 04 24 54 a2 10 c0 	movl   $0xc010a254,(%esp)
c0106b28:	e8 1e 98 ff ff       	call   c010034b <cprintf>
     // now access the virt pages to test  page relpacement algorithm 
     ret=check_content_access();
c0106b2d:	e8 6c fa ff ff       	call   c010659e <check_content_access>
c0106b32:	89 45 cc             	mov    %eax,-0x34(%ebp)
     assert(ret==0);
c0106b35:	83 7d cc 00          	cmpl   $0x0,-0x34(%ebp)
c0106b39:	74 24                	je     c0106b5f <check_swap+0x5a9>
c0106b3b:	c7 44 24 0c 7a a2 10 	movl   $0xc010a27a,0xc(%esp)
c0106b42:	c0 
c0106b43:	c7 44 24 08 62 9f 10 	movl   $0xc0109f62,0x8(%esp)
c0106b4a:	c0 
c0106b4b:	c7 44 24 04 ff 00 00 	movl   $0xff,0x4(%esp)
c0106b52:	00 
c0106b53:	c7 04 24 fc 9e 10 c0 	movl   $0xc0109efc,(%esp)
c0106b5a:	e8 76 a1 ff ff       	call   c0100cd5 <__panic>
     
     //restore kernel mem env
     for (i=0;i<CHECK_VALID_PHY_PAGE_NUM;i++) {
c0106b5f:	c7 45 ec 00 00 00 00 	movl   $0x0,-0x14(%ebp)
c0106b66:	eb 1e                	jmp    c0106b86 <check_swap+0x5d0>
         free_pages(check_rp[i],1);
c0106b68:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0106b6b:	8b 04 85 e0 1a 12 c0 	mov    -0x3fede520(,%eax,4),%eax
c0106b72:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c0106b79:	00 
c0106b7a:	89 04 24             	mov    %eax,(%esp)
c0106b7d:	e8 81 db ff ff       	call   c0104703 <free_pages>
     // now access the virt pages to test  page relpacement algorithm 
     ret=check_content_access();
     assert(ret==0);
     
     //restore kernel mem env
     for (i=0;i<CHECK_VALID_PHY_PAGE_NUM;i++) {
c0106b82:	83 45 ec 01          	addl   $0x1,-0x14(%ebp)
c0106b86:	83 7d ec 03          	cmpl   $0x3,-0x14(%ebp)
c0106b8a:	7e dc                	jle    c0106b68 <check_swap+0x5b2>
         free_pages(check_rp[i],1);
     } 

     //free_page(pte2page(*temp_ptep));
     
     mm_destroy(mm);
c0106b8c:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0106b8f:	89 04 24             	mov    %eax,(%esp)
c0106b92:	e8 92 08 00 00       	call   c0107429 <mm_destroy>
         
     nr_free = nr_free_store;
c0106b97:	8b 45 d0             	mov    -0x30(%ebp),%eax
c0106b9a:	a3 c8 1a 12 c0       	mov    %eax,0xc0121ac8
     free_list = free_list_store;
c0106b9f:	8b 45 98             	mov    -0x68(%ebp),%eax
c0106ba2:	8b 55 9c             	mov    -0x64(%ebp),%edx
c0106ba5:	a3 c0 1a 12 c0       	mov    %eax,0xc0121ac0
c0106baa:	89 15 c4 1a 12 c0    	mov    %edx,0xc0121ac4

     
     le = &free_list;
c0106bb0:	c7 45 e8 c0 1a 12 c0 	movl   $0xc0121ac0,-0x18(%ebp)
     while ((le = list_next(le)) != &free_list) {
c0106bb7:	eb 1d                	jmp    c0106bd6 <check_swap+0x620>
         struct Page *p = le2page(le, page_link);
c0106bb9:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0106bbc:	83 e8 0c             	sub    $0xc,%eax
c0106bbf:	89 45 c8             	mov    %eax,-0x38(%ebp)
         count --, total -= p->property;
c0106bc2:	83 6d f4 01          	subl   $0x1,-0xc(%ebp)
c0106bc6:	8b 55 f0             	mov    -0x10(%ebp),%edx
c0106bc9:	8b 45 c8             	mov    -0x38(%ebp),%eax
c0106bcc:	8b 40 08             	mov    0x8(%eax),%eax
c0106bcf:	29 c2                	sub    %eax,%edx
c0106bd1:	89 d0                	mov    %edx,%eax
c0106bd3:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0106bd6:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0106bd9:	89 45 a0             	mov    %eax,-0x60(%ebp)
 * list_next - get the next entry
 * @listelm:    the list head
 **/
static inline list_entry_t *
list_next(list_entry_t *listelm) {
    return listelm->next;
c0106bdc:	8b 45 a0             	mov    -0x60(%ebp),%eax
c0106bdf:	8b 40 04             	mov    0x4(%eax),%eax
     nr_free = nr_free_store;
     free_list = free_list_store;

     
     le = &free_list;
     while ((le = list_next(le)) != &free_list) {
c0106be2:	89 45 e8             	mov    %eax,-0x18(%ebp)
c0106be5:	81 7d e8 c0 1a 12 c0 	cmpl   $0xc0121ac0,-0x18(%ebp)
c0106bec:	75 cb                	jne    c0106bb9 <check_swap+0x603>
         struct Page *p = le2page(le, page_link);
         count --, total -= p->property;
     }
     cprintf("count is %d, total is %d\n",count,total);
c0106bee:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0106bf1:	89 44 24 08          	mov    %eax,0x8(%esp)
c0106bf5:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0106bf8:	89 44 24 04          	mov    %eax,0x4(%esp)
c0106bfc:	c7 04 24 81 a2 10 c0 	movl   $0xc010a281,(%esp)
c0106c03:	e8 43 97 ff ff       	call   c010034b <cprintf>
     //assert(count == 0);
     
     cprintf("check_swap() succeeded!\n");
c0106c08:	c7 04 24 9b a2 10 c0 	movl   $0xc010a29b,(%esp)
c0106c0f:	e8 37 97 ff ff       	call   c010034b <cprintf>
}
c0106c14:	83 c4 74             	add    $0x74,%esp
c0106c17:	5b                   	pop    %ebx
c0106c18:	5d                   	pop    %ebp
c0106c19:	c3                   	ret    

c0106c1a <_fifo_init_mm>:
 * (2) _fifo_init_mm: init pra_list_head and let  mm->sm_priv point to the addr of pra_list_head.
 *              Now, From the memory control struct mm_struct, we can access FIFO PRA
 */
static int
_fifo_init_mm(struct mm_struct *mm)
{     
c0106c1a:	55                   	push   %ebp
c0106c1b:	89 e5                	mov    %esp,%ebp
c0106c1d:	83 ec 10             	sub    $0x10,%esp
c0106c20:	c7 45 fc a4 1b 12 c0 	movl   $0xc0121ba4,-0x4(%ebp)
 * list_init - initialize a new entry
 * @elm:        new entry to be initialized
 * */
static inline void
list_init(list_entry_t *elm) {
    elm->prev = elm->next = elm;
c0106c27:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0106c2a:	8b 55 fc             	mov    -0x4(%ebp),%edx
c0106c2d:	89 50 04             	mov    %edx,0x4(%eax)
c0106c30:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0106c33:	8b 50 04             	mov    0x4(%eax),%edx
c0106c36:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0106c39:	89 10                	mov    %edx,(%eax)
     list_init(&pra_list_head);
     mm->sm_priv = &pra_list_head;
c0106c3b:	8b 45 08             	mov    0x8(%ebp),%eax
c0106c3e:	c7 40 14 a4 1b 12 c0 	movl   $0xc0121ba4,0x14(%eax)
     //cprintf(" mm->sm_priv %x in fifo_init_mm\n",mm->sm_priv);
     return 0;
c0106c45:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0106c4a:	c9                   	leave  
c0106c4b:	c3                   	ret    

c0106c4c <_fifo_map_swappable>:
/*
 * (3)_fifo_map_swappable: According FIFO PRA, we should link the most recent arrival page at the back of pra_list_head qeueue
 */
static int
_fifo_map_swappable(struct mm_struct *mm, uintptr_t addr, struct Page *page, int swap_in)
{
c0106c4c:	55                   	push   %ebp
c0106c4d:	89 e5                	mov    %esp,%ebp
c0106c4f:	83 ec 48             	sub    $0x48,%esp
    list_entry_t *head=(list_entry_t*) mm->sm_priv;
c0106c52:	8b 45 08             	mov    0x8(%ebp),%eax
c0106c55:	8b 40 14             	mov    0x14(%eax),%eax
c0106c58:	89 45 f4             	mov    %eax,-0xc(%ebp)
    list_entry_t *entry=&(page->pra_page_link);
c0106c5b:	8b 45 10             	mov    0x10(%ebp),%eax
c0106c5e:	83 c0 14             	add    $0x14,%eax
c0106c61:	89 45 f0             	mov    %eax,-0x10(%ebp)
 
    assert(entry != NULL && head != NULL);
c0106c64:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c0106c68:	74 06                	je     c0106c70 <_fifo_map_swappable+0x24>
c0106c6a:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0106c6e:	75 24                	jne    c0106c94 <_fifo_map_swappable+0x48>
c0106c70:	c7 44 24 0c b4 a2 10 	movl   $0xc010a2b4,0xc(%esp)
c0106c77:	c0 
c0106c78:	c7 44 24 08 d2 a2 10 	movl   $0xc010a2d2,0x8(%esp)
c0106c7f:	c0 
c0106c80:	c7 44 24 04 32 00 00 	movl   $0x32,0x4(%esp)
c0106c87:	00 
c0106c88:	c7 04 24 e7 a2 10 c0 	movl   $0xc010a2e7,(%esp)
c0106c8f:	e8 41 a0 ff ff       	call   c0100cd5 <__panic>
c0106c94:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0106c97:	89 45 ec             	mov    %eax,-0x14(%ebp)
c0106c9a:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0106c9d:	89 45 e8             	mov    %eax,-0x18(%ebp)
c0106ca0:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0106ca3:	89 45 e4             	mov    %eax,-0x1c(%ebp)
c0106ca6:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0106ca9:	89 45 e0             	mov    %eax,-0x20(%ebp)
 * Insert the new element @elm *after* the element @listelm which
 * is already in the list.
 * */
static inline void
list_add_after(list_entry_t *listelm, list_entry_t *elm) {
    __list_add(elm, listelm, listelm->next);
c0106cac:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0106caf:	8b 40 04             	mov    0x4(%eax),%eax
c0106cb2:	8b 55 e0             	mov    -0x20(%ebp),%edx
c0106cb5:	89 55 dc             	mov    %edx,-0x24(%ebp)
c0106cb8:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c0106cbb:	89 55 d8             	mov    %edx,-0x28(%ebp)
c0106cbe:	89 45 d4             	mov    %eax,-0x2c(%ebp)
 * This is only for internal list manipulation where we know
 * the prev/next entries already!
 * */
static inline void
__list_add(list_entry_t *elm, list_entry_t *prev, list_entry_t *next) {
    prev->next = next->prev = elm;
c0106cc1:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c0106cc4:	8b 55 dc             	mov    -0x24(%ebp),%edx
c0106cc7:	89 10                	mov    %edx,(%eax)
c0106cc9:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c0106ccc:	8b 10                	mov    (%eax),%edx
c0106cce:	8b 45 d8             	mov    -0x28(%ebp),%eax
c0106cd1:	89 50 04             	mov    %edx,0x4(%eax)
    elm->next = next;
c0106cd4:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0106cd7:	8b 55 d4             	mov    -0x2c(%ebp),%edx
c0106cda:	89 50 04             	mov    %edx,0x4(%eax)
    elm->prev = prev;
c0106cdd:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0106ce0:	8b 55 d8             	mov    -0x28(%ebp),%edx
c0106ce3:	89 10                	mov    %edx,(%eax)
    //record the page access situlation
    /*LAB3 EXERCISE 2: YOUR CODE*/ 
    list_add(head, entry);//在表头后加入新的page
    return 0;
c0106ce5:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0106cea:	c9                   	leave  
c0106ceb:	c3                   	ret    

c0106cec <_fifo_swap_out_victim>:
 *  (4)_fifo_swap_out_victim: According FIFO PRA, we should unlink the  earliest arrival page in front of pra_list_head qeueue,
 *                            then set the addr of addr of this page to ptr_page.
 */
static int
_fifo_swap_out_victim(struct mm_struct *mm, struct Page ** ptr_page, int in_tick)
{
c0106cec:	55                   	push   %ebp
c0106ced:	89 e5                	mov    %esp,%ebp
c0106cef:	83 ec 38             	sub    $0x38,%esp
     list_entry_t *head=(list_entry_t*) mm->sm_priv;
c0106cf2:	8b 45 08             	mov    0x8(%ebp),%eax
c0106cf5:	8b 40 14             	mov    0x14(%eax),%eax
c0106cf8:	89 45 f4             	mov    %eax,-0xc(%ebp)
         assert(head != NULL);
c0106cfb:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0106cff:	75 24                	jne    c0106d25 <_fifo_swap_out_victim+0x39>
c0106d01:	c7 44 24 0c fb a2 10 	movl   $0xc010a2fb,0xc(%esp)
c0106d08:	c0 
c0106d09:	c7 44 24 08 d2 a2 10 	movl   $0xc010a2d2,0x8(%esp)
c0106d10:	c0 
c0106d11:	c7 44 24 04 40 00 00 	movl   $0x40,0x4(%esp)
c0106d18:	00 
c0106d19:	c7 04 24 e7 a2 10 c0 	movl   $0xc010a2e7,(%esp)
c0106d20:	e8 b0 9f ff ff       	call   c0100cd5 <__panic>
     assert(in_tick==0);
c0106d25:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
c0106d29:	74 24                	je     c0106d4f <_fifo_swap_out_victim+0x63>
c0106d2b:	c7 44 24 0c 08 a3 10 	movl   $0xc010a308,0xc(%esp)
c0106d32:	c0 
c0106d33:	c7 44 24 08 d2 a2 10 	movl   $0xc010a2d2,0x8(%esp)
c0106d3a:	c0 
c0106d3b:	c7 44 24 04 41 00 00 	movl   $0x41,0x4(%esp)
c0106d42:	00 
c0106d43:	c7 04 24 e7 a2 10 c0 	movl   $0xc010a2e7,(%esp)
c0106d4a:	e8 86 9f ff ff       	call   c0100cd5 <__panic>
     list_entry_t *le = head->prev;//用le指示需要被换出的页
c0106d4f:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0106d52:	8b 00                	mov    (%eax),%eax
c0106d54:	89 45 f0             	mov    %eax,-0x10(%ebp)
          assert(head!=le);
c0106d57:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0106d5a:	3b 45 f0             	cmp    -0x10(%ebp),%eax
c0106d5d:	75 24                	jne    c0106d83 <_fifo_swap_out_victim+0x97>
c0106d5f:	c7 44 24 0c 13 a3 10 	movl   $0xc010a313,0xc(%esp)
c0106d66:	c0 
c0106d67:	c7 44 24 08 d2 a2 10 	movl   $0xc010a2d2,0x8(%esp)
c0106d6e:	c0 
c0106d6f:	c7 44 24 04 43 00 00 	movl   $0x43,0x4(%esp)
c0106d76:	00 
c0106d77:	c7 04 24 e7 a2 10 c0 	movl   $0xc010a2e7,(%esp)
c0106d7e:	e8 52 9f ff ff       	call   c0100cd5 <__panic>
          struct Page *p = le2page(le, pra_page_link); //le2page宏可以根据链表元素获得对应的Page指针p
c0106d83:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0106d86:	83 e8 14             	sub    $0x14,%eax
c0106d89:	89 45 ec             	mov    %eax,-0x14(%ebp)
c0106d8c:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0106d8f:	89 45 e8             	mov    %eax,-0x18(%ebp)
 * Note: list_empty() on @listelm does not return true after this, the entry is
 * in an undefined state.
 * */
static inline void
list_del(list_entry_t *listelm) {
    __list_del(listelm->prev, listelm->next);
c0106d92:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0106d95:	8b 40 04             	mov    0x4(%eax),%eax
c0106d98:	8b 55 e8             	mov    -0x18(%ebp),%edx
c0106d9b:	8b 12                	mov    (%edx),%edx
c0106d9d:	89 55 e4             	mov    %edx,-0x1c(%ebp)
c0106da0:	89 45 e0             	mov    %eax,-0x20(%ebp)
 * This is only for internal list manipulation where we know
 * the prev/next entries already!
 * */
static inline void
__list_del(list_entry_t *prev, list_entry_t *next) {
    prev->next = next;
c0106da3:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0106da6:	8b 55 e0             	mov    -0x20(%ebp),%edx
c0106da9:	89 50 04             	mov    %edx,0x4(%eax)
    next->prev = prev;
c0106dac:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0106daf:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c0106db2:	89 10                	mov    %edx,(%eax)
          list_del(le); //将进来最早的页面从队列中删除
          assert(p !=NULL);
c0106db4:	83 7d ec 00          	cmpl   $0x0,-0x14(%ebp)
c0106db8:	75 24                	jne    c0106dde <_fifo_swap_out_victim+0xf2>
c0106dba:	c7 44 24 0c 1c a3 10 	movl   $0xc010a31c,0xc(%esp)
c0106dc1:	c0 
c0106dc2:	c7 44 24 08 d2 a2 10 	movl   $0xc010a2d2,0x8(%esp)
c0106dc9:	c0 
c0106dca:	c7 44 24 04 46 00 00 	movl   $0x46,0x4(%esp)
c0106dd1:	00 
c0106dd2:	c7 04 24 e7 a2 10 c0 	movl   $0xc010a2e7,(%esp)
c0106dd9:	e8 f7 9e ff ff       	call   c0100cd5 <__panic>
          *ptr_page = p; //将进来最早的页面从队列中删除
c0106dde:	8b 45 0c             	mov    0xc(%ebp),%eax
c0106de1:	8b 55 ec             	mov    -0x14(%ebp),%edx
c0106de4:	89 10                	mov    %edx,(%eax)

     return 0;
c0106de6:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0106deb:	c9                   	leave  
c0106dec:	c3                   	ret    

c0106ded <_fifo_check_swap>:

static int
_fifo_check_swap(void) {
c0106ded:	55                   	push   %ebp
c0106dee:	89 e5                	mov    %esp,%ebp
c0106df0:	83 ec 18             	sub    $0x18,%esp
    cprintf("write Virt Page c in fifo_check_swap\n");
c0106df3:	c7 04 24 28 a3 10 c0 	movl   $0xc010a328,(%esp)
c0106dfa:	e8 4c 95 ff ff       	call   c010034b <cprintf>
    *(unsigned char *)0x3000 = 0x0c;
c0106dff:	b8 00 30 00 00       	mov    $0x3000,%eax
c0106e04:	c6 00 0c             	movb   $0xc,(%eax)
    assert(pgfault_num==4);
c0106e07:	a1 b8 1a 12 c0       	mov    0xc0121ab8,%eax
c0106e0c:	83 f8 04             	cmp    $0x4,%eax
c0106e0f:	74 24                	je     c0106e35 <_fifo_check_swap+0x48>
c0106e11:	c7 44 24 0c 4e a3 10 	movl   $0xc010a34e,0xc(%esp)
c0106e18:	c0 
c0106e19:	c7 44 24 08 d2 a2 10 	movl   $0xc010a2d2,0x8(%esp)
c0106e20:	c0 
c0106e21:	c7 44 24 04 50 00 00 	movl   $0x50,0x4(%esp)
c0106e28:	00 
c0106e29:	c7 04 24 e7 a2 10 c0 	movl   $0xc010a2e7,(%esp)
c0106e30:	e8 a0 9e ff ff       	call   c0100cd5 <__panic>
    cprintf("write Virt Page a in fifo_check_swap\n");
c0106e35:	c7 04 24 60 a3 10 c0 	movl   $0xc010a360,(%esp)
c0106e3c:	e8 0a 95 ff ff       	call   c010034b <cprintf>
    *(unsigned char *)0x1000 = 0x0a;
c0106e41:	b8 00 10 00 00       	mov    $0x1000,%eax
c0106e46:	c6 00 0a             	movb   $0xa,(%eax)
    assert(pgfault_num==4);
c0106e49:	a1 b8 1a 12 c0       	mov    0xc0121ab8,%eax
c0106e4e:	83 f8 04             	cmp    $0x4,%eax
c0106e51:	74 24                	je     c0106e77 <_fifo_check_swap+0x8a>
c0106e53:	c7 44 24 0c 4e a3 10 	movl   $0xc010a34e,0xc(%esp)
c0106e5a:	c0 
c0106e5b:	c7 44 24 08 d2 a2 10 	movl   $0xc010a2d2,0x8(%esp)
c0106e62:	c0 
c0106e63:	c7 44 24 04 53 00 00 	movl   $0x53,0x4(%esp)
c0106e6a:	00 
c0106e6b:	c7 04 24 e7 a2 10 c0 	movl   $0xc010a2e7,(%esp)
c0106e72:	e8 5e 9e ff ff       	call   c0100cd5 <__panic>
    cprintf("write Virt Page d in fifo_check_swap\n");
c0106e77:	c7 04 24 88 a3 10 c0 	movl   $0xc010a388,(%esp)
c0106e7e:	e8 c8 94 ff ff       	call   c010034b <cprintf>
    *(unsigned char *)0x4000 = 0x0d;
c0106e83:	b8 00 40 00 00       	mov    $0x4000,%eax
c0106e88:	c6 00 0d             	movb   $0xd,(%eax)
    assert(pgfault_num==4);
c0106e8b:	a1 b8 1a 12 c0       	mov    0xc0121ab8,%eax
c0106e90:	83 f8 04             	cmp    $0x4,%eax
c0106e93:	74 24                	je     c0106eb9 <_fifo_check_swap+0xcc>
c0106e95:	c7 44 24 0c 4e a3 10 	movl   $0xc010a34e,0xc(%esp)
c0106e9c:	c0 
c0106e9d:	c7 44 24 08 d2 a2 10 	movl   $0xc010a2d2,0x8(%esp)
c0106ea4:	c0 
c0106ea5:	c7 44 24 04 56 00 00 	movl   $0x56,0x4(%esp)
c0106eac:	00 
c0106ead:	c7 04 24 e7 a2 10 c0 	movl   $0xc010a2e7,(%esp)
c0106eb4:	e8 1c 9e ff ff       	call   c0100cd5 <__panic>
    cprintf("write Virt Page b in fifo_check_swap\n");
c0106eb9:	c7 04 24 b0 a3 10 c0 	movl   $0xc010a3b0,(%esp)
c0106ec0:	e8 86 94 ff ff       	call   c010034b <cprintf>
    *(unsigned char *)0x2000 = 0x0b;
c0106ec5:	b8 00 20 00 00       	mov    $0x2000,%eax
c0106eca:	c6 00 0b             	movb   $0xb,(%eax)
    assert(pgfault_num==4);
c0106ecd:	a1 b8 1a 12 c0       	mov    0xc0121ab8,%eax
c0106ed2:	83 f8 04             	cmp    $0x4,%eax
c0106ed5:	74 24                	je     c0106efb <_fifo_check_swap+0x10e>
c0106ed7:	c7 44 24 0c 4e a3 10 	movl   $0xc010a34e,0xc(%esp)
c0106ede:	c0 
c0106edf:	c7 44 24 08 d2 a2 10 	movl   $0xc010a2d2,0x8(%esp)
c0106ee6:	c0 
c0106ee7:	c7 44 24 04 59 00 00 	movl   $0x59,0x4(%esp)
c0106eee:	00 
c0106eef:	c7 04 24 e7 a2 10 c0 	movl   $0xc010a2e7,(%esp)
c0106ef6:	e8 da 9d ff ff       	call   c0100cd5 <__panic>
    cprintf("write Virt Page e in fifo_check_swap\n");
c0106efb:	c7 04 24 d8 a3 10 c0 	movl   $0xc010a3d8,(%esp)
c0106f02:	e8 44 94 ff ff       	call   c010034b <cprintf>
    *(unsigned char *)0x5000 = 0x0e;
c0106f07:	b8 00 50 00 00       	mov    $0x5000,%eax
c0106f0c:	c6 00 0e             	movb   $0xe,(%eax)
    assert(pgfault_num==5);
c0106f0f:	a1 b8 1a 12 c0       	mov    0xc0121ab8,%eax
c0106f14:	83 f8 05             	cmp    $0x5,%eax
c0106f17:	74 24                	je     c0106f3d <_fifo_check_swap+0x150>
c0106f19:	c7 44 24 0c fe a3 10 	movl   $0xc010a3fe,0xc(%esp)
c0106f20:	c0 
c0106f21:	c7 44 24 08 d2 a2 10 	movl   $0xc010a2d2,0x8(%esp)
c0106f28:	c0 
c0106f29:	c7 44 24 04 5c 00 00 	movl   $0x5c,0x4(%esp)
c0106f30:	00 
c0106f31:	c7 04 24 e7 a2 10 c0 	movl   $0xc010a2e7,(%esp)
c0106f38:	e8 98 9d ff ff       	call   c0100cd5 <__panic>
    cprintf("write Virt Page b in fifo_check_swap\n");
c0106f3d:	c7 04 24 b0 a3 10 c0 	movl   $0xc010a3b0,(%esp)
c0106f44:	e8 02 94 ff ff       	call   c010034b <cprintf>
    *(unsigned char *)0x2000 = 0x0b;
c0106f49:	b8 00 20 00 00       	mov    $0x2000,%eax
c0106f4e:	c6 00 0b             	movb   $0xb,(%eax)
    assert(pgfault_num==5);
c0106f51:	a1 b8 1a 12 c0       	mov    0xc0121ab8,%eax
c0106f56:	83 f8 05             	cmp    $0x5,%eax
c0106f59:	74 24                	je     c0106f7f <_fifo_check_swap+0x192>
c0106f5b:	c7 44 24 0c fe a3 10 	movl   $0xc010a3fe,0xc(%esp)
c0106f62:	c0 
c0106f63:	c7 44 24 08 d2 a2 10 	movl   $0xc010a2d2,0x8(%esp)
c0106f6a:	c0 
c0106f6b:	c7 44 24 04 5f 00 00 	movl   $0x5f,0x4(%esp)
c0106f72:	00 
c0106f73:	c7 04 24 e7 a2 10 c0 	movl   $0xc010a2e7,(%esp)
c0106f7a:	e8 56 9d ff ff       	call   c0100cd5 <__panic>
    cprintf("write Virt Page a in fifo_check_swap\n");
c0106f7f:	c7 04 24 60 a3 10 c0 	movl   $0xc010a360,(%esp)
c0106f86:	e8 c0 93 ff ff       	call   c010034b <cprintf>
    *(unsigned char *)0x1000 = 0x0a;
c0106f8b:	b8 00 10 00 00       	mov    $0x1000,%eax
c0106f90:	c6 00 0a             	movb   $0xa,(%eax)
    assert(pgfault_num==6);
c0106f93:	a1 b8 1a 12 c0       	mov    0xc0121ab8,%eax
c0106f98:	83 f8 06             	cmp    $0x6,%eax
c0106f9b:	74 24                	je     c0106fc1 <_fifo_check_swap+0x1d4>
c0106f9d:	c7 44 24 0c 0d a4 10 	movl   $0xc010a40d,0xc(%esp)
c0106fa4:	c0 
c0106fa5:	c7 44 24 08 d2 a2 10 	movl   $0xc010a2d2,0x8(%esp)
c0106fac:	c0 
c0106fad:	c7 44 24 04 62 00 00 	movl   $0x62,0x4(%esp)
c0106fb4:	00 
c0106fb5:	c7 04 24 e7 a2 10 c0 	movl   $0xc010a2e7,(%esp)
c0106fbc:	e8 14 9d ff ff       	call   c0100cd5 <__panic>
    cprintf("write Virt Page b in fifo_check_swap\n");
c0106fc1:	c7 04 24 b0 a3 10 c0 	movl   $0xc010a3b0,(%esp)
c0106fc8:	e8 7e 93 ff ff       	call   c010034b <cprintf>
    *(unsigned char *)0x2000 = 0x0b;
c0106fcd:	b8 00 20 00 00       	mov    $0x2000,%eax
c0106fd2:	c6 00 0b             	movb   $0xb,(%eax)
    assert(pgfault_num==7);
c0106fd5:	a1 b8 1a 12 c0       	mov    0xc0121ab8,%eax
c0106fda:	83 f8 07             	cmp    $0x7,%eax
c0106fdd:	74 24                	je     c0107003 <_fifo_check_swap+0x216>
c0106fdf:	c7 44 24 0c 1c a4 10 	movl   $0xc010a41c,0xc(%esp)
c0106fe6:	c0 
c0106fe7:	c7 44 24 08 d2 a2 10 	movl   $0xc010a2d2,0x8(%esp)
c0106fee:	c0 
c0106fef:	c7 44 24 04 65 00 00 	movl   $0x65,0x4(%esp)
c0106ff6:	00 
c0106ff7:	c7 04 24 e7 a2 10 c0 	movl   $0xc010a2e7,(%esp)
c0106ffe:	e8 d2 9c ff ff       	call   c0100cd5 <__panic>
    cprintf("write Virt Page c in fifo_check_swap\n");
c0107003:	c7 04 24 28 a3 10 c0 	movl   $0xc010a328,(%esp)
c010700a:	e8 3c 93 ff ff       	call   c010034b <cprintf>
    *(unsigned char *)0x3000 = 0x0c;
c010700f:	b8 00 30 00 00       	mov    $0x3000,%eax
c0107014:	c6 00 0c             	movb   $0xc,(%eax)
    assert(pgfault_num==8);
c0107017:	a1 b8 1a 12 c0       	mov    0xc0121ab8,%eax
c010701c:	83 f8 08             	cmp    $0x8,%eax
c010701f:	74 24                	je     c0107045 <_fifo_check_swap+0x258>
c0107021:	c7 44 24 0c 2b a4 10 	movl   $0xc010a42b,0xc(%esp)
c0107028:	c0 
c0107029:	c7 44 24 08 d2 a2 10 	movl   $0xc010a2d2,0x8(%esp)
c0107030:	c0 
c0107031:	c7 44 24 04 68 00 00 	movl   $0x68,0x4(%esp)
c0107038:	00 
c0107039:	c7 04 24 e7 a2 10 c0 	movl   $0xc010a2e7,(%esp)
c0107040:	e8 90 9c ff ff       	call   c0100cd5 <__panic>
    cprintf("write Virt Page d in fifo_check_swap\n");
c0107045:	c7 04 24 88 a3 10 c0 	movl   $0xc010a388,(%esp)
c010704c:	e8 fa 92 ff ff       	call   c010034b <cprintf>
    *(unsigned char *)0x4000 = 0x0d;
c0107051:	b8 00 40 00 00       	mov    $0x4000,%eax
c0107056:	c6 00 0d             	movb   $0xd,(%eax)
    assert(pgfault_num==9);
c0107059:	a1 b8 1a 12 c0       	mov    0xc0121ab8,%eax
c010705e:	83 f8 09             	cmp    $0x9,%eax
c0107061:	74 24                	je     c0107087 <_fifo_check_swap+0x29a>
c0107063:	c7 44 24 0c 3a a4 10 	movl   $0xc010a43a,0xc(%esp)
c010706a:	c0 
c010706b:	c7 44 24 08 d2 a2 10 	movl   $0xc010a2d2,0x8(%esp)
c0107072:	c0 
c0107073:	c7 44 24 04 6b 00 00 	movl   $0x6b,0x4(%esp)
c010707a:	00 
c010707b:	c7 04 24 e7 a2 10 c0 	movl   $0xc010a2e7,(%esp)
c0107082:	e8 4e 9c ff ff       	call   c0100cd5 <__panic>
    return 0;
c0107087:	b8 00 00 00 00       	mov    $0x0,%eax
}
c010708c:	c9                   	leave  
c010708d:	c3                   	ret    

c010708e <_fifo_init>:


static int
_fifo_init(void)
{
c010708e:	55                   	push   %ebp
c010708f:	89 e5                	mov    %esp,%ebp
    return 0;
c0107091:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0107096:	5d                   	pop    %ebp
c0107097:	c3                   	ret    

c0107098 <_fifo_set_unswappable>:

static int
_fifo_set_unswappable(struct mm_struct *mm, uintptr_t addr)
{
c0107098:	55                   	push   %ebp
c0107099:	89 e5                	mov    %esp,%ebp
    return 0;
c010709b:	b8 00 00 00 00       	mov    $0x0,%eax
}
c01070a0:	5d                   	pop    %ebp
c01070a1:	c3                   	ret    

c01070a2 <_fifo_tick_event>:

static int
_fifo_tick_event(struct mm_struct *mm)
{ return 0; }
c01070a2:	55                   	push   %ebp
c01070a3:	89 e5                	mov    %esp,%ebp
c01070a5:	b8 00 00 00 00       	mov    $0x0,%eax
c01070aa:	5d                   	pop    %ebp
c01070ab:	c3                   	ret    

c01070ac <pa2page>:
page2pa(struct Page *page) {
    return page2ppn(page) << PGSHIFT;
}

static inline struct Page *
pa2page(uintptr_t pa) {
c01070ac:	55                   	push   %ebp
c01070ad:	89 e5                	mov    %esp,%ebp
c01070af:	83 ec 18             	sub    $0x18,%esp
    if (PPN(pa) >= npage) {
c01070b2:	8b 45 08             	mov    0x8(%ebp),%eax
c01070b5:	c1 e8 0c             	shr    $0xc,%eax
c01070b8:	89 c2                	mov    %eax,%edx
c01070ba:	a1 20 1a 12 c0       	mov    0xc0121a20,%eax
c01070bf:	39 c2                	cmp    %eax,%edx
c01070c1:	72 1c                	jb     c01070df <pa2page+0x33>
        panic("pa2page called with invalid pa");
c01070c3:	c7 44 24 08 5c a4 10 	movl   $0xc010a45c,0x8(%esp)
c01070ca:	c0 
c01070cb:	c7 44 24 04 5b 00 00 	movl   $0x5b,0x4(%esp)
c01070d2:	00 
c01070d3:	c7 04 24 7b a4 10 c0 	movl   $0xc010a47b,(%esp)
c01070da:	e8 f6 9b ff ff       	call   c0100cd5 <__panic>
    }
    return &pages[PPN(pa)];
c01070df:	a1 d4 1a 12 c0       	mov    0xc0121ad4,%eax
c01070e4:	8b 55 08             	mov    0x8(%ebp),%edx
c01070e7:	c1 ea 0c             	shr    $0xc,%edx
c01070ea:	c1 e2 05             	shl    $0x5,%edx
c01070ed:	01 d0                	add    %edx,%eax
}
c01070ef:	c9                   	leave  
c01070f0:	c3                   	ret    

c01070f1 <mm_create>:
static void check_vma_struct(void);
static void check_pgfault(void);

// mm_create -  alloc a mm_struct & initialize it.
struct mm_struct *
mm_create(void) {
c01070f1:	55                   	push   %ebp
c01070f2:	89 e5                	mov    %esp,%ebp
c01070f4:	83 ec 28             	sub    $0x28,%esp
    struct mm_struct *mm = kmalloc(sizeof(struct mm_struct));
c01070f7:	c7 04 24 18 00 00 00 	movl   $0x18,(%esp)
c01070fe:	e8 c7 ed ff ff       	call   c0105eca <kmalloc>
c0107103:	89 45 f4             	mov    %eax,-0xc(%ebp)

    if (mm != NULL) {
c0107106:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c010710a:	74 58                	je     c0107164 <mm_create+0x73>
        list_init(&(mm->mmap_list));
c010710c:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010710f:	89 45 f0             	mov    %eax,-0x10(%ebp)
 * list_init - initialize a new entry
 * @elm:        new entry to be initialized
 * */
static inline void
list_init(list_entry_t *elm) {
    elm->prev = elm->next = elm;
c0107112:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0107115:	8b 55 f0             	mov    -0x10(%ebp),%edx
c0107118:	89 50 04             	mov    %edx,0x4(%eax)
c010711b:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010711e:	8b 50 04             	mov    0x4(%eax),%edx
c0107121:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0107124:	89 10                	mov    %edx,(%eax)
        mm->mmap_cache = NULL;
c0107126:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107129:	c7 40 08 00 00 00 00 	movl   $0x0,0x8(%eax)
        mm->pgdir = NULL;
c0107130:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107133:	c7 40 0c 00 00 00 00 	movl   $0x0,0xc(%eax)
        mm->map_count = 0;
c010713a:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010713d:	c7 40 10 00 00 00 00 	movl   $0x0,0x10(%eax)

        if (swap_init_ok) swap_init_mm(mm);
c0107144:	a1 ac 1a 12 c0       	mov    0xc0121aac,%eax
c0107149:	85 c0                	test   %eax,%eax
c010714b:	74 0d                	je     c010715a <mm_create+0x69>
c010714d:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107150:	89 04 24             	mov    %eax,(%esp)
c0107153:	e8 bf ef ff ff       	call   c0106117 <swap_init_mm>
c0107158:	eb 0a                	jmp    c0107164 <mm_create+0x73>
        else mm->sm_priv = NULL;
c010715a:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010715d:	c7 40 14 00 00 00 00 	movl   $0x0,0x14(%eax)
    }
    return mm;
c0107164:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c0107167:	c9                   	leave  
c0107168:	c3                   	ret    

c0107169 <vma_create>:

// vma_create - alloc a vma_struct & initialize it. (addr range: vm_start~vm_end)
struct vma_struct *
vma_create(uintptr_t vm_start, uintptr_t vm_end, uint32_t vm_flags) {
c0107169:	55                   	push   %ebp
c010716a:	89 e5                	mov    %esp,%ebp
c010716c:	83 ec 28             	sub    $0x28,%esp
    struct vma_struct *vma = kmalloc(sizeof(struct vma_struct));
c010716f:	c7 04 24 18 00 00 00 	movl   $0x18,(%esp)
c0107176:	e8 4f ed ff ff       	call   c0105eca <kmalloc>
c010717b:	89 45 f4             	mov    %eax,-0xc(%ebp)

    if (vma != NULL) {
c010717e:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0107182:	74 1b                	je     c010719f <vma_create+0x36>
        vma->vm_start = vm_start;
c0107184:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107187:	8b 55 08             	mov    0x8(%ebp),%edx
c010718a:	89 50 04             	mov    %edx,0x4(%eax)
        vma->vm_end = vm_end;
c010718d:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107190:	8b 55 0c             	mov    0xc(%ebp),%edx
c0107193:	89 50 08             	mov    %edx,0x8(%eax)
        vma->vm_flags = vm_flags;
c0107196:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107199:	8b 55 10             	mov    0x10(%ebp),%edx
c010719c:	89 50 0c             	mov    %edx,0xc(%eax)
    }
    return vma;
c010719f:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c01071a2:	c9                   	leave  
c01071a3:	c3                   	ret    

c01071a4 <find_vma>:


// find_vma - find a vma  (vma->vm_start <= addr <= vma_vm_end)
struct vma_struct *
find_vma(struct mm_struct *mm, uintptr_t addr) {
c01071a4:	55                   	push   %ebp
c01071a5:	89 e5                	mov    %esp,%ebp
c01071a7:	83 ec 20             	sub    $0x20,%esp
    struct vma_struct *vma = NULL;
c01071aa:	c7 45 fc 00 00 00 00 	movl   $0x0,-0x4(%ebp)
    if (mm != NULL) {
c01071b1:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
c01071b5:	0f 84 95 00 00 00    	je     c0107250 <find_vma+0xac>
        vma = mm->mmap_cache;
c01071bb:	8b 45 08             	mov    0x8(%ebp),%eax
c01071be:	8b 40 08             	mov    0x8(%eax),%eax
c01071c1:	89 45 fc             	mov    %eax,-0x4(%ebp)
        if (!(vma != NULL && vma->vm_start <= addr && vma->vm_end > addr)) {
c01071c4:	83 7d fc 00          	cmpl   $0x0,-0x4(%ebp)
c01071c8:	74 16                	je     c01071e0 <find_vma+0x3c>
c01071ca:	8b 45 fc             	mov    -0x4(%ebp),%eax
c01071cd:	8b 40 04             	mov    0x4(%eax),%eax
c01071d0:	3b 45 0c             	cmp    0xc(%ebp),%eax
c01071d3:	77 0b                	ja     c01071e0 <find_vma+0x3c>
c01071d5:	8b 45 fc             	mov    -0x4(%ebp),%eax
c01071d8:	8b 40 08             	mov    0x8(%eax),%eax
c01071db:	3b 45 0c             	cmp    0xc(%ebp),%eax
c01071de:	77 61                	ja     c0107241 <find_vma+0x9d>
                bool found = 0;
c01071e0:	c7 45 f8 00 00 00 00 	movl   $0x0,-0x8(%ebp)
                list_entry_t *list = &(mm->mmap_list), *le = list;
c01071e7:	8b 45 08             	mov    0x8(%ebp),%eax
c01071ea:	89 45 f0             	mov    %eax,-0x10(%ebp)
c01071ed:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01071f0:	89 45 f4             	mov    %eax,-0xc(%ebp)
                while ((le = list_next(le)) != list) {
c01071f3:	eb 28                	jmp    c010721d <find_vma+0x79>
                    vma = le2vma(le, list_link);
c01071f5:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01071f8:	83 e8 10             	sub    $0x10,%eax
c01071fb:	89 45 fc             	mov    %eax,-0x4(%ebp)
                    if (vma->vm_start<=addr && addr < vma->vm_end) {
c01071fe:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0107201:	8b 40 04             	mov    0x4(%eax),%eax
c0107204:	3b 45 0c             	cmp    0xc(%ebp),%eax
c0107207:	77 14                	ja     c010721d <find_vma+0x79>
c0107209:	8b 45 fc             	mov    -0x4(%ebp),%eax
c010720c:	8b 40 08             	mov    0x8(%eax),%eax
c010720f:	3b 45 0c             	cmp    0xc(%ebp),%eax
c0107212:	76 09                	jbe    c010721d <find_vma+0x79>
                        found = 1;
c0107214:	c7 45 f8 01 00 00 00 	movl   $0x1,-0x8(%ebp)
                        break;
c010721b:	eb 17                	jmp    c0107234 <find_vma+0x90>
c010721d:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107220:	89 45 ec             	mov    %eax,-0x14(%ebp)
 * list_next - get the next entry
 * @listelm:    the list head
 **/
static inline list_entry_t *
list_next(list_entry_t *listelm) {
    return listelm->next;
c0107223:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0107226:	8b 40 04             	mov    0x4(%eax),%eax
    if (mm != NULL) {
        vma = mm->mmap_cache;
        if (!(vma != NULL && vma->vm_start <= addr && vma->vm_end > addr)) {
                bool found = 0;
                list_entry_t *list = &(mm->mmap_list), *le = list;
                while ((le = list_next(le)) != list) {
c0107229:	89 45 f4             	mov    %eax,-0xc(%ebp)
c010722c:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010722f:	3b 45 f0             	cmp    -0x10(%ebp),%eax
c0107232:	75 c1                	jne    c01071f5 <find_vma+0x51>
                    if (vma->vm_start<=addr && addr < vma->vm_end) {
                        found = 1;
                        break;
                    }
                }
                if (!found) {
c0107234:	83 7d f8 00          	cmpl   $0x0,-0x8(%ebp)
c0107238:	75 07                	jne    c0107241 <find_vma+0x9d>
                    vma = NULL;
c010723a:	c7 45 fc 00 00 00 00 	movl   $0x0,-0x4(%ebp)
                }
        }
        if (vma != NULL) {
c0107241:	83 7d fc 00          	cmpl   $0x0,-0x4(%ebp)
c0107245:	74 09                	je     c0107250 <find_vma+0xac>
            mm->mmap_cache = vma;
c0107247:	8b 45 08             	mov    0x8(%ebp),%eax
c010724a:	8b 55 fc             	mov    -0x4(%ebp),%edx
c010724d:	89 50 08             	mov    %edx,0x8(%eax)
        }
    }
    return vma;
c0107250:	8b 45 fc             	mov    -0x4(%ebp),%eax
}
c0107253:	c9                   	leave  
c0107254:	c3                   	ret    

c0107255 <check_vma_overlap>:


// check_vma_overlap - check if vma1 overlaps vma2 ?
static inline void
check_vma_overlap(struct vma_struct *prev, struct vma_struct *next) {
c0107255:	55                   	push   %ebp
c0107256:	89 e5                	mov    %esp,%ebp
c0107258:	83 ec 18             	sub    $0x18,%esp
    assert(prev->vm_start < prev->vm_end);
c010725b:	8b 45 08             	mov    0x8(%ebp),%eax
c010725e:	8b 50 04             	mov    0x4(%eax),%edx
c0107261:	8b 45 08             	mov    0x8(%ebp),%eax
c0107264:	8b 40 08             	mov    0x8(%eax),%eax
c0107267:	39 c2                	cmp    %eax,%edx
c0107269:	72 24                	jb     c010728f <check_vma_overlap+0x3a>
c010726b:	c7 44 24 0c 89 a4 10 	movl   $0xc010a489,0xc(%esp)
c0107272:	c0 
c0107273:	c7 44 24 08 a7 a4 10 	movl   $0xc010a4a7,0x8(%esp)
c010727a:	c0 
c010727b:	c7 44 24 04 67 00 00 	movl   $0x67,0x4(%esp)
c0107282:	00 
c0107283:	c7 04 24 bc a4 10 c0 	movl   $0xc010a4bc,(%esp)
c010728a:	e8 46 9a ff ff       	call   c0100cd5 <__panic>
    assert(prev->vm_end <= next->vm_start);
c010728f:	8b 45 08             	mov    0x8(%ebp),%eax
c0107292:	8b 50 08             	mov    0x8(%eax),%edx
c0107295:	8b 45 0c             	mov    0xc(%ebp),%eax
c0107298:	8b 40 04             	mov    0x4(%eax),%eax
c010729b:	39 c2                	cmp    %eax,%edx
c010729d:	76 24                	jbe    c01072c3 <check_vma_overlap+0x6e>
c010729f:	c7 44 24 0c cc a4 10 	movl   $0xc010a4cc,0xc(%esp)
c01072a6:	c0 
c01072a7:	c7 44 24 08 a7 a4 10 	movl   $0xc010a4a7,0x8(%esp)
c01072ae:	c0 
c01072af:	c7 44 24 04 68 00 00 	movl   $0x68,0x4(%esp)
c01072b6:	00 
c01072b7:	c7 04 24 bc a4 10 c0 	movl   $0xc010a4bc,(%esp)
c01072be:	e8 12 9a ff ff       	call   c0100cd5 <__panic>
    assert(next->vm_start < next->vm_end);
c01072c3:	8b 45 0c             	mov    0xc(%ebp),%eax
c01072c6:	8b 50 04             	mov    0x4(%eax),%edx
c01072c9:	8b 45 0c             	mov    0xc(%ebp),%eax
c01072cc:	8b 40 08             	mov    0x8(%eax),%eax
c01072cf:	39 c2                	cmp    %eax,%edx
c01072d1:	72 24                	jb     c01072f7 <check_vma_overlap+0xa2>
c01072d3:	c7 44 24 0c eb a4 10 	movl   $0xc010a4eb,0xc(%esp)
c01072da:	c0 
c01072db:	c7 44 24 08 a7 a4 10 	movl   $0xc010a4a7,0x8(%esp)
c01072e2:	c0 
c01072e3:	c7 44 24 04 69 00 00 	movl   $0x69,0x4(%esp)
c01072ea:	00 
c01072eb:	c7 04 24 bc a4 10 c0 	movl   $0xc010a4bc,(%esp)
c01072f2:	e8 de 99 ff ff       	call   c0100cd5 <__panic>
}
c01072f7:	c9                   	leave  
c01072f8:	c3                   	ret    

c01072f9 <insert_vma_struct>:


// insert_vma_struct -insert vma in mm's list link
void
insert_vma_struct(struct mm_struct *mm, struct vma_struct *vma) {
c01072f9:	55                   	push   %ebp
c01072fa:	89 e5                	mov    %esp,%ebp
c01072fc:	83 ec 48             	sub    $0x48,%esp
    assert(vma->vm_start < vma->vm_end);
c01072ff:	8b 45 0c             	mov    0xc(%ebp),%eax
c0107302:	8b 50 04             	mov    0x4(%eax),%edx
c0107305:	8b 45 0c             	mov    0xc(%ebp),%eax
c0107308:	8b 40 08             	mov    0x8(%eax),%eax
c010730b:	39 c2                	cmp    %eax,%edx
c010730d:	72 24                	jb     c0107333 <insert_vma_struct+0x3a>
c010730f:	c7 44 24 0c 09 a5 10 	movl   $0xc010a509,0xc(%esp)
c0107316:	c0 
c0107317:	c7 44 24 08 a7 a4 10 	movl   $0xc010a4a7,0x8(%esp)
c010731e:	c0 
c010731f:	c7 44 24 04 70 00 00 	movl   $0x70,0x4(%esp)
c0107326:	00 
c0107327:	c7 04 24 bc a4 10 c0 	movl   $0xc010a4bc,(%esp)
c010732e:	e8 a2 99 ff ff       	call   c0100cd5 <__panic>
    list_entry_t *list = &(mm->mmap_list);
c0107333:	8b 45 08             	mov    0x8(%ebp),%eax
c0107336:	89 45 ec             	mov    %eax,-0x14(%ebp)
    list_entry_t *le_prev = list, *le_next;
c0107339:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010733c:	89 45 f4             	mov    %eax,-0xc(%ebp)

        list_entry_t *le = list;
c010733f:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0107342:	89 45 f0             	mov    %eax,-0x10(%ebp)
        while ((le = list_next(le)) != list) {
c0107345:	eb 21                	jmp    c0107368 <insert_vma_struct+0x6f>
            struct vma_struct *mmap_prev = le2vma(le, list_link);
c0107347:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010734a:	83 e8 10             	sub    $0x10,%eax
c010734d:	89 45 e8             	mov    %eax,-0x18(%ebp)
            if (mmap_prev->vm_start > vma->vm_start) {
c0107350:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0107353:	8b 50 04             	mov    0x4(%eax),%edx
c0107356:	8b 45 0c             	mov    0xc(%ebp),%eax
c0107359:	8b 40 04             	mov    0x4(%eax),%eax
c010735c:	39 c2                	cmp    %eax,%edx
c010735e:	76 02                	jbe    c0107362 <insert_vma_struct+0x69>
                break;
c0107360:	eb 1d                	jmp    c010737f <insert_vma_struct+0x86>
            }
            le_prev = le;
c0107362:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0107365:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0107368:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010736b:	89 45 e0             	mov    %eax,-0x20(%ebp)
c010736e:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0107371:	8b 40 04             	mov    0x4(%eax),%eax
    assert(vma->vm_start < vma->vm_end);
    list_entry_t *list = &(mm->mmap_list);
    list_entry_t *le_prev = list, *le_next;

        list_entry_t *le = list;
        while ((le = list_next(le)) != list) {
c0107374:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0107377:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010737a:	3b 45 ec             	cmp    -0x14(%ebp),%eax
c010737d:	75 c8                	jne    c0107347 <insert_vma_struct+0x4e>
c010737f:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107382:	89 45 dc             	mov    %eax,-0x24(%ebp)
c0107385:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0107388:	8b 40 04             	mov    0x4(%eax),%eax
                break;
            }
            le_prev = le;
        }

    le_next = list_next(le_prev);
c010738b:	89 45 e4             	mov    %eax,-0x1c(%ebp)

    /* check overlap */
    if (le_prev != list) {
c010738e:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107391:	3b 45 ec             	cmp    -0x14(%ebp),%eax
c0107394:	74 15                	je     c01073ab <insert_vma_struct+0xb2>
        check_vma_overlap(le2vma(le_prev, list_link), vma);
c0107396:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107399:	8d 50 f0             	lea    -0x10(%eax),%edx
c010739c:	8b 45 0c             	mov    0xc(%ebp),%eax
c010739f:	89 44 24 04          	mov    %eax,0x4(%esp)
c01073a3:	89 14 24             	mov    %edx,(%esp)
c01073a6:	e8 aa fe ff ff       	call   c0107255 <check_vma_overlap>
    }
    if (le_next != list) {
c01073ab:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c01073ae:	3b 45 ec             	cmp    -0x14(%ebp),%eax
c01073b1:	74 15                	je     c01073c8 <insert_vma_struct+0xcf>
        check_vma_overlap(vma, le2vma(le_next, list_link));
c01073b3:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c01073b6:	83 e8 10             	sub    $0x10,%eax
c01073b9:	89 44 24 04          	mov    %eax,0x4(%esp)
c01073bd:	8b 45 0c             	mov    0xc(%ebp),%eax
c01073c0:	89 04 24             	mov    %eax,(%esp)
c01073c3:	e8 8d fe ff ff       	call   c0107255 <check_vma_overlap>
    }

    vma->vm_mm = mm;
c01073c8:	8b 45 0c             	mov    0xc(%ebp),%eax
c01073cb:	8b 55 08             	mov    0x8(%ebp),%edx
c01073ce:	89 10                	mov    %edx,(%eax)
    list_add_after(le_prev, &(vma->list_link));
c01073d0:	8b 45 0c             	mov    0xc(%ebp),%eax
c01073d3:	8d 50 10             	lea    0x10(%eax),%edx
c01073d6:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01073d9:	89 45 d8             	mov    %eax,-0x28(%ebp)
c01073dc:	89 55 d4             	mov    %edx,-0x2c(%ebp)
 * Insert the new element @elm *after* the element @listelm which
 * is already in the list.
 * */
static inline void
list_add_after(list_entry_t *listelm, list_entry_t *elm) {
    __list_add(elm, listelm, listelm->next);
c01073df:	8b 45 d8             	mov    -0x28(%ebp),%eax
c01073e2:	8b 40 04             	mov    0x4(%eax),%eax
c01073e5:	8b 55 d4             	mov    -0x2c(%ebp),%edx
c01073e8:	89 55 d0             	mov    %edx,-0x30(%ebp)
c01073eb:	8b 55 d8             	mov    -0x28(%ebp),%edx
c01073ee:	89 55 cc             	mov    %edx,-0x34(%ebp)
c01073f1:	89 45 c8             	mov    %eax,-0x38(%ebp)
 * This is only for internal list manipulation where we know
 * the prev/next entries already!
 * */
static inline void
__list_add(list_entry_t *elm, list_entry_t *prev, list_entry_t *next) {
    prev->next = next->prev = elm;
c01073f4:	8b 45 c8             	mov    -0x38(%ebp),%eax
c01073f7:	8b 55 d0             	mov    -0x30(%ebp),%edx
c01073fa:	89 10                	mov    %edx,(%eax)
c01073fc:	8b 45 c8             	mov    -0x38(%ebp),%eax
c01073ff:	8b 10                	mov    (%eax),%edx
c0107401:	8b 45 cc             	mov    -0x34(%ebp),%eax
c0107404:	89 50 04             	mov    %edx,0x4(%eax)
    elm->next = next;
c0107407:	8b 45 d0             	mov    -0x30(%ebp),%eax
c010740a:	8b 55 c8             	mov    -0x38(%ebp),%edx
c010740d:	89 50 04             	mov    %edx,0x4(%eax)
    elm->prev = prev;
c0107410:	8b 45 d0             	mov    -0x30(%ebp),%eax
c0107413:	8b 55 cc             	mov    -0x34(%ebp),%edx
c0107416:	89 10                	mov    %edx,(%eax)

    mm->map_count ++;
c0107418:	8b 45 08             	mov    0x8(%ebp),%eax
c010741b:	8b 40 10             	mov    0x10(%eax),%eax
c010741e:	8d 50 01             	lea    0x1(%eax),%edx
c0107421:	8b 45 08             	mov    0x8(%ebp),%eax
c0107424:	89 50 10             	mov    %edx,0x10(%eax)
}
c0107427:	c9                   	leave  
c0107428:	c3                   	ret    

c0107429 <mm_destroy>:

// mm_destroy - free mm and mm internal fields
void
mm_destroy(struct mm_struct *mm) {
c0107429:	55                   	push   %ebp
c010742a:	89 e5                	mov    %esp,%ebp
c010742c:	83 ec 38             	sub    $0x38,%esp

    list_entry_t *list = &(mm->mmap_list), *le;
c010742f:	8b 45 08             	mov    0x8(%ebp),%eax
c0107432:	89 45 f4             	mov    %eax,-0xc(%ebp)
    while ((le = list_next(list)) != list) {
c0107435:	eb 3e                	jmp    c0107475 <mm_destroy+0x4c>
c0107437:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010743a:	89 45 ec             	mov    %eax,-0x14(%ebp)
 * Note: list_empty() on @listelm does not return true after this, the entry is
 * in an undefined state.
 * */
static inline void
list_del(list_entry_t *listelm) {
    __list_del(listelm->prev, listelm->next);
c010743d:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0107440:	8b 40 04             	mov    0x4(%eax),%eax
c0107443:	8b 55 ec             	mov    -0x14(%ebp),%edx
c0107446:	8b 12                	mov    (%edx),%edx
c0107448:	89 55 e8             	mov    %edx,-0x18(%ebp)
c010744b:	89 45 e4             	mov    %eax,-0x1c(%ebp)
 * This is only for internal list manipulation where we know
 * the prev/next entries already!
 * */
static inline void
__list_del(list_entry_t *prev, list_entry_t *next) {
    prev->next = next;
c010744e:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0107451:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c0107454:	89 50 04             	mov    %edx,0x4(%eax)
    next->prev = prev;
c0107457:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c010745a:	8b 55 e8             	mov    -0x18(%ebp),%edx
c010745d:	89 10                	mov    %edx,(%eax)
        list_del(le);
        kfree(le2vma(le, list_link),sizeof(struct vma_struct));  //kfree vma        
c010745f:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0107462:	83 e8 10             	sub    $0x10,%eax
c0107465:	c7 44 24 04 18 00 00 	movl   $0x18,0x4(%esp)
c010746c:	00 
c010746d:	89 04 24             	mov    %eax,(%esp)
c0107470:	e8 f5 ea ff ff       	call   c0105f6a <kfree>
c0107475:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107478:	89 45 e0             	mov    %eax,-0x20(%ebp)
 * list_next - get the next entry
 * @listelm:    the list head
 **/
static inline list_entry_t *
list_next(list_entry_t *listelm) {
    return listelm->next;
c010747b:	8b 45 e0             	mov    -0x20(%ebp),%eax
c010747e:	8b 40 04             	mov    0x4(%eax),%eax
// mm_destroy - free mm and mm internal fields
void
mm_destroy(struct mm_struct *mm) {

    list_entry_t *list = &(mm->mmap_list), *le;
    while ((le = list_next(list)) != list) {
c0107481:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0107484:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0107487:	3b 45 f4             	cmp    -0xc(%ebp),%eax
c010748a:	75 ab                	jne    c0107437 <mm_destroy+0xe>
        list_del(le);
        kfree(le2vma(le, list_link),sizeof(struct vma_struct));  //kfree vma        
    }
    kfree(mm, sizeof(struct mm_struct)); //kfree mm
c010748c:	c7 44 24 04 18 00 00 	movl   $0x18,0x4(%esp)
c0107493:	00 
c0107494:	8b 45 08             	mov    0x8(%ebp),%eax
c0107497:	89 04 24             	mov    %eax,(%esp)
c010749a:	e8 cb ea ff ff       	call   c0105f6a <kfree>
    mm=NULL;
c010749f:	c7 45 08 00 00 00 00 	movl   $0x0,0x8(%ebp)
}
c01074a6:	c9                   	leave  
c01074a7:	c3                   	ret    

c01074a8 <vmm_init>:

// vmm_init - initialize virtual memory management
//          - now just call check_vmm to check correctness of vmm
void
vmm_init(void) {
c01074a8:	55                   	push   %ebp
c01074a9:	89 e5                	mov    %esp,%ebp
c01074ab:	83 ec 08             	sub    $0x8,%esp
    check_vmm();
c01074ae:	e8 02 00 00 00       	call   c01074b5 <check_vmm>
}
c01074b3:	c9                   	leave  
c01074b4:	c3                   	ret    

c01074b5 <check_vmm>:

// check_vmm - check correctness of vmm
static void
check_vmm(void) {
c01074b5:	55                   	push   %ebp
c01074b6:	89 e5                	mov    %esp,%ebp
c01074b8:	83 ec 28             	sub    $0x28,%esp
    size_t nr_free_pages_store = nr_free_pages();
c01074bb:	e8 75 d2 ff ff       	call   c0104735 <nr_free_pages>
c01074c0:	89 45 f4             	mov    %eax,-0xc(%ebp)
    
    check_vma_struct();
c01074c3:	e8 41 00 00 00       	call   c0107509 <check_vma_struct>
    check_pgfault();
c01074c8:	e8 03 05 00 00       	call   c01079d0 <check_pgfault>

    assert(nr_free_pages_store == nr_free_pages());
c01074cd:	e8 63 d2 ff ff       	call   c0104735 <nr_free_pages>
c01074d2:	3b 45 f4             	cmp    -0xc(%ebp),%eax
c01074d5:	74 24                	je     c01074fb <check_vmm+0x46>
c01074d7:	c7 44 24 0c 28 a5 10 	movl   $0xc010a528,0xc(%esp)
c01074de:	c0 
c01074df:	c7 44 24 08 a7 a4 10 	movl   $0xc010a4a7,0x8(%esp)
c01074e6:	c0 
c01074e7:	c7 44 24 04 a9 00 00 	movl   $0xa9,0x4(%esp)
c01074ee:	00 
c01074ef:	c7 04 24 bc a4 10 c0 	movl   $0xc010a4bc,(%esp)
c01074f6:	e8 da 97 ff ff       	call   c0100cd5 <__panic>

    cprintf("check_vmm() succeeded.\n");
c01074fb:	c7 04 24 4f a5 10 c0 	movl   $0xc010a54f,(%esp)
c0107502:	e8 44 8e ff ff       	call   c010034b <cprintf>
}
c0107507:	c9                   	leave  
c0107508:	c3                   	ret    

c0107509 <check_vma_struct>:

static void
check_vma_struct(void) {
c0107509:	55                   	push   %ebp
c010750a:	89 e5                	mov    %esp,%ebp
c010750c:	83 ec 68             	sub    $0x68,%esp
    size_t nr_free_pages_store = nr_free_pages();
c010750f:	e8 21 d2 ff ff       	call   c0104735 <nr_free_pages>
c0107514:	89 45 ec             	mov    %eax,-0x14(%ebp)

    struct mm_struct *mm = mm_create();
c0107517:	e8 d5 fb ff ff       	call   c01070f1 <mm_create>
c010751c:	89 45 e8             	mov    %eax,-0x18(%ebp)
    assert(mm != NULL);
c010751f:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
c0107523:	75 24                	jne    c0107549 <check_vma_struct+0x40>
c0107525:	c7 44 24 0c 67 a5 10 	movl   $0xc010a567,0xc(%esp)
c010752c:	c0 
c010752d:	c7 44 24 08 a7 a4 10 	movl   $0xc010a4a7,0x8(%esp)
c0107534:	c0 
c0107535:	c7 44 24 04 b3 00 00 	movl   $0xb3,0x4(%esp)
c010753c:	00 
c010753d:	c7 04 24 bc a4 10 c0 	movl   $0xc010a4bc,(%esp)
c0107544:	e8 8c 97 ff ff       	call   c0100cd5 <__panic>

    int step1 = 10, step2 = step1 * 10;
c0107549:	c7 45 e4 0a 00 00 00 	movl   $0xa,-0x1c(%ebp)
c0107550:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c0107553:	89 d0                	mov    %edx,%eax
c0107555:	c1 e0 02             	shl    $0x2,%eax
c0107558:	01 d0                	add    %edx,%eax
c010755a:	01 c0                	add    %eax,%eax
c010755c:	89 45 e0             	mov    %eax,-0x20(%ebp)

    int i;
    for (i = step1; i >= 1; i --) {
c010755f:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0107562:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0107565:	eb 70                	jmp    c01075d7 <check_vma_struct+0xce>
        struct vma_struct *vma = vma_create(i * 5, i * 5 + 2, 0);
c0107567:	8b 55 f4             	mov    -0xc(%ebp),%edx
c010756a:	89 d0                	mov    %edx,%eax
c010756c:	c1 e0 02             	shl    $0x2,%eax
c010756f:	01 d0                	add    %edx,%eax
c0107571:	83 c0 02             	add    $0x2,%eax
c0107574:	89 c1                	mov    %eax,%ecx
c0107576:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0107579:	89 d0                	mov    %edx,%eax
c010757b:	c1 e0 02             	shl    $0x2,%eax
c010757e:	01 d0                	add    %edx,%eax
c0107580:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c0107587:	00 
c0107588:	89 4c 24 04          	mov    %ecx,0x4(%esp)
c010758c:	89 04 24             	mov    %eax,(%esp)
c010758f:	e8 d5 fb ff ff       	call   c0107169 <vma_create>
c0107594:	89 45 dc             	mov    %eax,-0x24(%ebp)
        assert(vma != NULL);
c0107597:	83 7d dc 00          	cmpl   $0x0,-0x24(%ebp)
c010759b:	75 24                	jne    c01075c1 <check_vma_struct+0xb8>
c010759d:	c7 44 24 0c 72 a5 10 	movl   $0xc010a572,0xc(%esp)
c01075a4:	c0 
c01075a5:	c7 44 24 08 a7 a4 10 	movl   $0xc010a4a7,0x8(%esp)
c01075ac:	c0 
c01075ad:	c7 44 24 04 ba 00 00 	movl   $0xba,0x4(%esp)
c01075b4:	00 
c01075b5:	c7 04 24 bc a4 10 c0 	movl   $0xc010a4bc,(%esp)
c01075bc:	e8 14 97 ff ff       	call   c0100cd5 <__panic>
        insert_vma_struct(mm, vma);
c01075c1:	8b 45 dc             	mov    -0x24(%ebp),%eax
c01075c4:	89 44 24 04          	mov    %eax,0x4(%esp)
c01075c8:	8b 45 e8             	mov    -0x18(%ebp),%eax
c01075cb:	89 04 24             	mov    %eax,(%esp)
c01075ce:	e8 26 fd ff ff       	call   c01072f9 <insert_vma_struct>
    assert(mm != NULL);

    int step1 = 10, step2 = step1 * 10;

    int i;
    for (i = step1; i >= 1; i --) {
c01075d3:	83 6d f4 01          	subl   $0x1,-0xc(%ebp)
c01075d7:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c01075db:	7f 8a                	jg     c0107567 <check_vma_struct+0x5e>
        struct vma_struct *vma = vma_create(i * 5, i * 5 + 2, 0);
        assert(vma != NULL);
        insert_vma_struct(mm, vma);
    }

    for (i = step1 + 1; i <= step2; i ++) {
c01075dd:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c01075e0:	83 c0 01             	add    $0x1,%eax
c01075e3:	89 45 f4             	mov    %eax,-0xc(%ebp)
c01075e6:	eb 70                	jmp    c0107658 <check_vma_struct+0x14f>
        struct vma_struct *vma = vma_create(i * 5, i * 5 + 2, 0);
c01075e8:	8b 55 f4             	mov    -0xc(%ebp),%edx
c01075eb:	89 d0                	mov    %edx,%eax
c01075ed:	c1 e0 02             	shl    $0x2,%eax
c01075f0:	01 d0                	add    %edx,%eax
c01075f2:	83 c0 02             	add    $0x2,%eax
c01075f5:	89 c1                	mov    %eax,%ecx
c01075f7:	8b 55 f4             	mov    -0xc(%ebp),%edx
c01075fa:	89 d0                	mov    %edx,%eax
c01075fc:	c1 e0 02             	shl    $0x2,%eax
c01075ff:	01 d0                	add    %edx,%eax
c0107601:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c0107608:	00 
c0107609:	89 4c 24 04          	mov    %ecx,0x4(%esp)
c010760d:	89 04 24             	mov    %eax,(%esp)
c0107610:	e8 54 fb ff ff       	call   c0107169 <vma_create>
c0107615:	89 45 d8             	mov    %eax,-0x28(%ebp)
        assert(vma != NULL);
c0107618:	83 7d d8 00          	cmpl   $0x0,-0x28(%ebp)
c010761c:	75 24                	jne    c0107642 <check_vma_struct+0x139>
c010761e:	c7 44 24 0c 72 a5 10 	movl   $0xc010a572,0xc(%esp)
c0107625:	c0 
c0107626:	c7 44 24 08 a7 a4 10 	movl   $0xc010a4a7,0x8(%esp)
c010762d:	c0 
c010762e:	c7 44 24 04 c0 00 00 	movl   $0xc0,0x4(%esp)
c0107635:	00 
c0107636:	c7 04 24 bc a4 10 c0 	movl   $0xc010a4bc,(%esp)
c010763d:	e8 93 96 ff ff       	call   c0100cd5 <__panic>
        insert_vma_struct(mm, vma);
c0107642:	8b 45 d8             	mov    -0x28(%ebp),%eax
c0107645:	89 44 24 04          	mov    %eax,0x4(%esp)
c0107649:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010764c:	89 04 24             	mov    %eax,(%esp)
c010764f:	e8 a5 fc ff ff       	call   c01072f9 <insert_vma_struct>
        struct vma_struct *vma = vma_create(i * 5, i * 5 + 2, 0);
        assert(vma != NULL);
        insert_vma_struct(mm, vma);
    }

    for (i = step1 + 1; i <= step2; i ++) {
c0107654:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
c0107658:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010765b:	3b 45 e0             	cmp    -0x20(%ebp),%eax
c010765e:	7e 88                	jle    c01075e8 <check_vma_struct+0xdf>
        struct vma_struct *vma = vma_create(i * 5, i * 5 + 2, 0);
        assert(vma != NULL);
        insert_vma_struct(mm, vma);
    }

    list_entry_t *le = list_next(&(mm->mmap_list));
c0107660:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0107663:	89 45 b8             	mov    %eax,-0x48(%ebp)
c0107666:	8b 45 b8             	mov    -0x48(%ebp),%eax
c0107669:	8b 40 04             	mov    0x4(%eax),%eax
c010766c:	89 45 f0             	mov    %eax,-0x10(%ebp)

    for (i = 1; i <= step2; i ++) {
c010766f:	c7 45 f4 01 00 00 00 	movl   $0x1,-0xc(%ebp)
c0107676:	e9 97 00 00 00       	jmp    c0107712 <check_vma_struct+0x209>
        assert(le != &(mm->mmap_list));
c010767b:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010767e:	3b 45 f0             	cmp    -0x10(%ebp),%eax
c0107681:	75 24                	jne    c01076a7 <check_vma_struct+0x19e>
c0107683:	c7 44 24 0c 7e a5 10 	movl   $0xc010a57e,0xc(%esp)
c010768a:	c0 
c010768b:	c7 44 24 08 a7 a4 10 	movl   $0xc010a4a7,0x8(%esp)
c0107692:	c0 
c0107693:	c7 44 24 04 c7 00 00 	movl   $0xc7,0x4(%esp)
c010769a:	00 
c010769b:	c7 04 24 bc a4 10 c0 	movl   $0xc010a4bc,(%esp)
c01076a2:	e8 2e 96 ff ff       	call   c0100cd5 <__panic>
        struct vma_struct *mmap = le2vma(le, list_link);
c01076a7:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01076aa:	83 e8 10             	sub    $0x10,%eax
c01076ad:	89 45 d4             	mov    %eax,-0x2c(%ebp)
        assert(mmap->vm_start == i * 5 && mmap->vm_end == i * 5 + 2);
c01076b0:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c01076b3:	8b 48 04             	mov    0x4(%eax),%ecx
c01076b6:	8b 55 f4             	mov    -0xc(%ebp),%edx
c01076b9:	89 d0                	mov    %edx,%eax
c01076bb:	c1 e0 02             	shl    $0x2,%eax
c01076be:	01 d0                	add    %edx,%eax
c01076c0:	39 c1                	cmp    %eax,%ecx
c01076c2:	75 17                	jne    c01076db <check_vma_struct+0x1d2>
c01076c4:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c01076c7:	8b 48 08             	mov    0x8(%eax),%ecx
c01076ca:	8b 55 f4             	mov    -0xc(%ebp),%edx
c01076cd:	89 d0                	mov    %edx,%eax
c01076cf:	c1 e0 02             	shl    $0x2,%eax
c01076d2:	01 d0                	add    %edx,%eax
c01076d4:	83 c0 02             	add    $0x2,%eax
c01076d7:	39 c1                	cmp    %eax,%ecx
c01076d9:	74 24                	je     c01076ff <check_vma_struct+0x1f6>
c01076db:	c7 44 24 0c 98 a5 10 	movl   $0xc010a598,0xc(%esp)
c01076e2:	c0 
c01076e3:	c7 44 24 08 a7 a4 10 	movl   $0xc010a4a7,0x8(%esp)
c01076ea:	c0 
c01076eb:	c7 44 24 04 c9 00 00 	movl   $0xc9,0x4(%esp)
c01076f2:	00 
c01076f3:	c7 04 24 bc a4 10 c0 	movl   $0xc010a4bc,(%esp)
c01076fa:	e8 d6 95 ff ff       	call   c0100cd5 <__panic>
c01076ff:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0107702:	89 45 b4             	mov    %eax,-0x4c(%ebp)
c0107705:	8b 45 b4             	mov    -0x4c(%ebp),%eax
c0107708:	8b 40 04             	mov    0x4(%eax),%eax
        le = list_next(le);
c010770b:	89 45 f0             	mov    %eax,-0x10(%ebp)
        insert_vma_struct(mm, vma);
    }

    list_entry_t *le = list_next(&(mm->mmap_list));

    for (i = 1; i <= step2; i ++) {
c010770e:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
c0107712:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107715:	3b 45 e0             	cmp    -0x20(%ebp),%eax
c0107718:	0f 8e 5d ff ff ff    	jle    c010767b <check_vma_struct+0x172>
        struct vma_struct *mmap = le2vma(le, list_link);
        assert(mmap->vm_start == i * 5 && mmap->vm_end == i * 5 + 2);
        le = list_next(le);
    }

    for (i = 5; i <= 5 * step2; i +=5) {
c010771e:	c7 45 f4 05 00 00 00 	movl   $0x5,-0xc(%ebp)
c0107725:	e9 cd 01 00 00       	jmp    c01078f7 <check_vma_struct+0x3ee>
        struct vma_struct *vma1 = find_vma(mm, i);
c010772a:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010772d:	89 44 24 04          	mov    %eax,0x4(%esp)
c0107731:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0107734:	89 04 24             	mov    %eax,(%esp)
c0107737:	e8 68 fa ff ff       	call   c01071a4 <find_vma>
c010773c:	89 45 d0             	mov    %eax,-0x30(%ebp)
        assert(vma1 != NULL);
c010773f:	83 7d d0 00          	cmpl   $0x0,-0x30(%ebp)
c0107743:	75 24                	jne    c0107769 <check_vma_struct+0x260>
c0107745:	c7 44 24 0c cd a5 10 	movl   $0xc010a5cd,0xc(%esp)
c010774c:	c0 
c010774d:	c7 44 24 08 a7 a4 10 	movl   $0xc010a4a7,0x8(%esp)
c0107754:	c0 
c0107755:	c7 44 24 04 cf 00 00 	movl   $0xcf,0x4(%esp)
c010775c:	00 
c010775d:	c7 04 24 bc a4 10 c0 	movl   $0xc010a4bc,(%esp)
c0107764:	e8 6c 95 ff ff       	call   c0100cd5 <__panic>
        struct vma_struct *vma2 = find_vma(mm, i+1);
c0107769:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010776c:	83 c0 01             	add    $0x1,%eax
c010776f:	89 44 24 04          	mov    %eax,0x4(%esp)
c0107773:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0107776:	89 04 24             	mov    %eax,(%esp)
c0107779:	e8 26 fa ff ff       	call   c01071a4 <find_vma>
c010777e:	89 45 cc             	mov    %eax,-0x34(%ebp)
        assert(vma2 != NULL);
c0107781:	83 7d cc 00          	cmpl   $0x0,-0x34(%ebp)
c0107785:	75 24                	jne    c01077ab <check_vma_struct+0x2a2>
c0107787:	c7 44 24 0c da a5 10 	movl   $0xc010a5da,0xc(%esp)
c010778e:	c0 
c010778f:	c7 44 24 08 a7 a4 10 	movl   $0xc010a4a7,0x8(%esp)
c0107796:	c0 
c0107797:	c7 44 24 04 d1 00 00 	movl   $0xd1,0x4(%esp)
c010779e:	00 
c010779f:	c7 04 24 bc a4 10 c0 	movl   $0xc010a4bc,(%esp)
c01077a6:	e8 2a 95 ff ff       	call   c0100cd5 <__panic>
        struct vma_struct *vma3 = find_vma(mm, i+2);
c01077ab:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01077ae:	83 c0 02             	add    $0x2,%eax
c01077b1:	89 44 24 04          	mov    %eax,0x4(%esp)
c01077b5:	8b 45 e8             	mov    -0x18(%ebp),%eax
c01077b8:	89 04 24             	mov    %eax,(%esp)
c01077bb:	e8 e4 f9 ff ff       	call   c01071a4 <find_vma>
c01077c0:	89 45 c8             	mov    %eax,-0x38(%ebp)
        assert(vma3 == NULL);
c01077c3:	83 7d c8 00          	cmpl   $0x0,-0x38(%ebp)
c01077c7:	74 24                	je     c01077ed <check_vma_struct+0x2e4>
c01077c9:	c7 44 24 0c e7 a5 10 	movl   $0xc010a5e7,0xc(%esp)
c01077d0:	c0 
c01077d1:	c7 44 24 08 a7 a4 10 	movl   $0xc010a4a7,0x8(%esp)
c01077d8:	c0 
c01077d9:	c7 44 24 04 d3 00 00 	movl   $0xd3,0x4(%esp)
c01077e0:	00 
c01077e1:	c7 04 24 bc a4 10 c0 	movl   $0xc010a4bc,(%esp)
c01077e8:	e8 e8 94 ff ff       	call   c0100cd5 <__panic>
        struct vma_struct *vma4 = find_vma(mm, i+3);
c01077ed:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01077f0:	83 c0 03             	add    $0x3,%eax
c01077f3:	89 44 24 04          	mov    %eax,0x4(%esp)
c01077f7:	8b 45 e8             	mov    -0x18(%ebp),%eax
c01077fa:	89 04 24             	mov    %eax,(%esp)
c01077fd:	e8 a2 f9 ff ff       	call   c01071a4 <find_vma>
c0107802:	89 45 c4             	mov    %eax,-0x3c(%ebp)
        assert(vma4 == NULL);
c0107805:	83 7d c4 00          	cmpl   $0x0,-0x3c(%ebp)
c0107809:	74 24                	je     c010782f <check_vma_struct+0x326>
c010780b:	c7 44 24 0c f4 a5 10 	movl   $0xc010a5f4,0xc(%esp)
c0107812:	c0 
c0107813:	c7 44 24 08 a7 a4 10 	movl   $0xc010a4a7,0x8(%esp)
c010781a:	c0 
c010781b:	c7 44 24 04 d5 00 00 	movl   $0xd5,0x4(%esp)
c0107822:	00 
c0107823:	c7 04 24 bc a4 10 c0 	movl   $0xc010a4bc,(%esp)
c010782a:	e8 a6 94 ff ff       	call   c0100cd5 <__panic>
        struct vma_struct *vma5 = find_vma(mm, i+4);
c010782f:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107832:	83 c0 04             	add    $0x4,%eax
c0107835:	89 44 24 04          	mov    %eax,0x4(%esp)
c0107839:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010783c:	89 04 24             	mov    %eax,(%esp)
c010783f:	e8 60 f9 ff ff       	call   c01071a4 <find_vma>
c0107844:	89 45 c0             	mov    %eax,-0x40(%ebp)
        assert(vma5 == NULL);
c0107847:	83 7d c0 00          	cmpl   $0x0,-0x40(%ebp)
c010784b:	74 24                	je     c0107871 <check_vma_struct+0x368>
c010784d:	c7 44 24 0c 01 a6 10 	movl   $0xc010a601,0xc(%esp)
c0107854:	c0 
c0107855:	c7 44 24 08 a7 a4 10 	movl   $0xc010a4a7,0x8(%esp)
c010785c:	c0 
c010785d:	c7 44 24 04 d7 00 00 	movl   $0xd7,0x4(%esp)
c0107864:	00 
c0107865:	c7 04 24 bc a4 10 c0 	movl   $0xc010a4bc,(%esp)
c010786c:	e8 64 94 ff ff       	call   c0100cd5 <__panic>

        assert(vma1->vm_start == i  && vma1->vm_end == i  + 2);
c0107871:	8b 45 d0             	mov    -0x30(%ebp),%eax
c0107874:	8b 50 04             	mov    0x4(%eax),%edx
c0107877:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010787a:	39 c2                	cmp    %eax,%edx
c010787c:	75 10                	jne    c010788e <check_vma_struct+0x385>
c010787e:	8b 45 d0             	mov    -0x30(%ebp),%eax
c0107881:	8b 50 08             	mov    0x8(%eax),%edx
c0107884:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107887:	83 c0 02             	add    $0x2,%eax
c010788a:	39 c2                	cmp    %eax,%edx
c010788c:	74 24                	je     c01078b2 <check_vma_struct+0x3a9>
c010788e:	c7 44 24 0c 10 a6 10 	movl   $0xc010a610,0xc(%esp)
c0107895:	c0 
c0107896:	c7 44 24 08 a7 a4 10 	movl   $0xc010a4a7,0x8(%esp)
c010789d:	c0 
c010789e:	c7 44 24 04 d9 00 00 	movl   $0xd9,0x4(%esp)
c01078a5:	00 
c01078a6:	c7 04 24 bc a4 10 c0 	movl   $0xc010a4bc,(%esp)
c01078ad:	e8 23 94 ff ff       	call   c0100cd5 <__panic>
        assert(vma2->vm_start == i  && vma2->vm_end == i  + 2);
c01078b2:	8b 45 cc             	mov    -0x34(%ebp),%eax
c01078b5:	8b 50 04             	mov    0x4(%eax),%edx
c01078b8:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01078bb:	39 c2                	cmp    %eax,%edx
c01078bd:	75 10                	jne    c01078cf <check_vma_struct+0x3c6>
c01078bf:	8b 45 cc             	mov    -0x34(%ebp),%eax
c01078c2:	8b 50 08             	mov    0x8(%eax),%edx
c01078c5:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01078c8:	83 c0 02             	add    $0x2,%eax
c01078cb:	39 c2                	cmp    %eax,%edx
c01078cd:	74 24                	je     c01078f3 <check_vma_struct+0x3ea>
c01078cf:	c7 44 24 0c 40 a6 10 	movl   $0xc010a640,0xc(%esp)
c01078d6:	c0 
c01078d7:	c7 44 24 08 a7 a4 10 	movl   $0xc010a4a7,0x8(%esp)
c01078de:	c0 
c01078df:	c7 44 24 04 da 00 00 	movl   $0xda,0x4(%esp)
c01078e6:	00 
c01078e7:	c7 04 24 bc a4 10 c0 	movl   $0xc010a4bc,(%esp)
c01078ee:	e8 e2 93 ff ff       	call   c0100cd5 <__panic>
        struct vma_struct *mmap = le2vma(le, list_link);
        assert(mmap->vm_start == i * 5 && mmap->vm_end == i * 5 + 2);
        le = list_next(le);
    }

    for (i = 5; i <= 5 * step2; i +=5) {
c01078f3:	83 45 f4 05          	addl   $0x5,-0xc(%ebp)
c01078f7:	8b 55 e0             	mov    -0x20(%ebp),%edx
c01078fa:	89 d0                	mov    %edx,%eax
c01078fc:	c1 e0 02             	shl    $0x2,%eax
c01078ff:	01 d0                	add    %edx,%eax
c0107901:	3b 45 f4             	cmp    -0xc(%ebp),%eax
c0107904:	0f 8d 20 fe ff ff    	jge    c010772a <check_vma_struct+0x221>

        assert(vma1->vm_start == i  && vma1->vm_end == i  + 2);
        assert(vma2->vm_start == i  && vma2->vm_end == i  + 2);
    }

    for (i =4; i>=0; i--) {
c010790a:	c7 45 f4 04 00 00 00 	movl   $0x4,-0xc(%ebp)
c0107911:	eb 70                	jmp    c0107983 <check_vma_struct+0x47a>
        struct vma_struct *vma_below_5= find_vma(mm,i);
c0107913:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107916:	89 44 24 04          	mov    %eax,0x4(%esp)
c010791a:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010791d:	89 04 24             	mov    %eax,(%esp)
c0107920:	e8 7f f8 ff ff       	call   c01071a4 <find_vma>
c0107925:	89 45 bc             	mov    %eax,-0x44(%ebp)
        if (vma_below_5 != NULL ) {
c0107928:	83 7d bc 00          	cmpl   $0x0,-0x44(%ebp)
c010792c:	74 27                	je     c0107955 <check_vma_struct+0x44c>
           cprintf("vma_below_5: i %x, start %x, end %x\n",i, vma_below_5->vm_start, vma_below_5->vm_end); 
c010792e:	8b 45 bc             	mov    -0x44(%ebp),%eax
c0107931:	8b 50 08             	mov    0x8(%eax),%edx
c0107934:	8b 45 bc             	mov    -0x44(%ebp),%eax
c0107937:	8b 40 04             	mov    0x4(%eax),%eax
c010793a:	89 54 24 0c          	mov    %edx,0xc(%esp)
c010793e:	89 44 24 08          	mov    %eax,0x8(%esp)
c0107942:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107945:	89 44 24 04          	mov    %eax,0x4(%esp)
c0107949:	c7 04 24 70 a6 10 c0 	movl   $0xc010a670,(%esp)
c0107950:	e8 f6 89 ff ff       	call   c010034b <cprintf>
        }
        assert(vma_below_5 == NULL);
c0107955:	83 7d bc 00          	cmpl   $0x0,-0x44(%ebp)
c0107959:	74 24                	je     c010797f <check_vma_struct+0x476>
c010795b:	c7 44 24 0c 95 a6 10 	movl   $0xc010a695,0xc(%esp)
c0107962:	c0 
c0107963:	c7 44 24 08 a7 a4 10 	movl   $0xc010a4a7,0x8(%esp)
c010796a:	c0 
c010796b:	c7 44 24 04 e2 00 00 	movl   $0xe2,0x4(%esp)
c0107972:	00 
c0107973:	c7 04 24 bc a4 10 c0 	movl   $0xc010a4bc,(%esp)
c010797a:	e8 56 93 ff ff       	call   c0100cd5 <__panic>

        assert(vma1->vm_start == i  && vma1->vm_end == i  + 2);
        assert(vma2->vm_start == i  && vma2->vm_end == i  + 2);
    }

    for (i =4; i>=0; i--) {
c010797f:	83 6d f4 01          	subl   $0x1,-0xc(%ebp)
c0107983:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0107987:	79 8a                	jns    c0107913 <check_vma_struct+0x40a>
           cprintf("vma_below_5: i %x, start %x, end %x\n",i, vma_below_5->vm_start, vma_below_5->vm_end); 
        }
        assert(vma_below_5 == NULL);
    }

    mm_destroy(mm);
c0107989:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010798c:	89 04 24             	mov    %eax,(%esp)
c010798f:	e8 95 fa ff ff       	call   c0107429 <mm_destroy>

    assert(nr_free_pages_store == nr_free_pages());
c0107994:	e8 9c cd ff ff       	call   c0104735 <nr_free_pages>
c0107999:	3b 45 ec             	cmp    -0x14(%ebp),%eax
c010799c:	74 24                	je     c01079c2 <check_vma_struct+0x4b9>
c010799e:	c7 44 24 0c 28 a5 10 	movl   $0xc010a528,0xc(%esp)
c01079a5:	c0 
c01079a6:	c7 44 24 08 a7 a4 10 	movl   $0xc010a4a7,0x8(%esp)
c01079ad:	c0 
c01079ae:	c7 44 24 04 e7 00 00 	movl   $0xe7,0x4(%esp)
c01079b5:	00 
c01079b6:	c7 04 24 bc a4 10 c0 	movl   $0xc010a4bc,(%esp)
c01079bd:	e8 13 93 ff ff       	call   c0100cd5 <__panic>

    cprintf("check_vma_struct() succeeded!\n");
c01079c2:	c7 04 24 ac a6 10 c0 	movl   $0xc010a6ac,(%esp)
c01079c9:	e8 7d 89 ff ff       	call   c010034b <cprintf>
}
c01079ce:	c9                   	leave  
c01079cf:	c3                   	ret    

c01079d0 <check_pgfault>:

struct mm_struct *check_mm_struct;

// check_pgfault - check correctness of pgfault handler
static void
check_pgfault(void) {
c01079d0:	55                   	push   %ebp
c01079d1:	89 e5                	mov    %esp,%ebp
c01079d3:	83 ec 38             	sub    $0x38,%esp
    size_t nr_free_pages_store = nr_free_pages();
c01079d6:	e8 5a cd ff ff       	call   c0104735 <nr_free_pages>
c01079db:	89 45 ec             	mov    %eax,-0x14(%ebp)

    check_mm_struct = mm_create();
c01079de:	e8 0e f7 ff ff       	call   c01070f1 <mm_create>
c01079e3:	a3 ac 1b 12 c0       	mov    %eax,0xc0121bac
    assert(check_mm_struct != NULL);
c01079e8:	a1 ac 1b 12 c0       	mov    0xc0121bac,%eax
c01079ed:	85 c0                	test   %eax,%eax
c01079ef:	75 24                	jne    c0107a15 <check_pgfault+0x45>
c01079f1:	c7 44 24 0c cb a6 10 	movl   $0xc010a6cb,0xc(%esp)
c01079f8:	c0 
c01079f9:	c7 44 24 08 a7 a4 10 	movl   $0xc010a4a7,0x8(%esp)
c0107a00:	c0 
c0107a01:	c7 44 24 04 f4 00 00 	movl   $0xf4,0x4(%esp)
c0107a08:	00 
c0107a09:	c7 04 24 bc a4 10 c0 	movl   $0xc010a4bc,(%esp)
c0107a10:	e8 c0 92 ff ff       	call   c0100cd5 <__panic>

    struct mm_struct *mm = check_mm_struct;
c0107a15:	a1 ac 1b 12 c0       	mov    0xc0121bac,%eax
c0107a1a:	89 45 e8             	mov    %eax,-0x18(%ebp)
    pde_t *pgdir = mm->pgdir = boot_pgdir;
c0107a1d:	8b 15 24 1a 12 c0    	mov    0xc0121a24,%edx
c0107a23:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0107a26:	89 50 0c             	mov    %edx,0xc(%eax)
c0107a29:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0107a2c:	8b 40 0c             	mov    0xc(%eax),%eax
c0107a2f:	89 45 e4             	mov    %eax,-0x1c(%ebp)
    assert(pgdir[0] == 0);
c0107a32:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0107a35:	8b 00                	mov    (%eax),%eax
c0107a37:	85 c0                	test   %eax,%eax
c0107a39:	74 24                	je     c0107a5f <check_pgfault+0x8f>
c0107a3b:	c7 44 24 0c e3 a6 10 	movl   $0xc010a6e3,0xc(%esp)
c0107a42:	c0 
c0107a43:	c7 44 24 08 a7 a4 10 	movl   $0xc010a4a7,0x8(%esp)
c0107a4a:	c0 
c0107a4b:	c7 44 24 04 f8 00 00 	movl   $0xf8,0x4(%esp)
c0107a52:	00 
c0107a53:	c7 04 24 bc a4 10 c0 	movl   $0xc010a4bc,(%esp)
c0107a5a:	e8 76 92 ff ff       	call   c0100cd5 <__panic>

    struct vma_struct *vma = vma_create(0, PTSIZE, VM_WRITE);
c0107a5f:	c7 44 24 08 02 00 00 	movl   $0x2,0x8(%esp)
c0107a66:	00 
c0107a67:	c7 44 24 04 00 00 40 	movl   $0x400000,0x4(%esp)
c0107a6e:	00 
c0107a6f:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
c0107a76:	e8 ee f6 ff ff       	call   c0107169 <vma_create>
c0107a7b:	89 45 e0             	mov    %eax,-0x20(%ebp)
    assert(vma != NULL);
c0107a7e:	83 7d e0 00          	cmpl   $0x0,-0x20(%ebp)
c0107a82:	75 24                	jne    c0107aa8 <check_pgfault+0xd8>
c0107a84:	c7 44 24 0c 72 a5 10 	movl   $0xc010a572,0xc(%esp)
c0107a8b:	c0 
c0107a8c:	c7 44 24 08 a7 a4 10 	movl   $0xc010a4a7,0x8(%esp)
c0107a93:	c0 
c0107a94:	c7 44 24 04 fb 00 00 	movl   $0xfb,0x4(%esp)
c0107a9b:	00 
c0107a9c:	c7 04 24 bc a4 10 c0 	movl   $0xc010a4bc,(%esp)
c0107aa3:	e8 2d 92 ff ff       	call   c0100cd5 <__panic>

    insert_vma_struct(mm, vma);
c0107aa8:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0107aab:	89 44 24 04          	mov    %eax,0x4(%esp)
c0107aaf:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0107ab2:	89 04 24             	mov    %eax,(%esp)
c0107ab5:	e8 3f f8 ff ff       	call   c01072f9 <insert_vma_struct>

    uintptr_t addr = 0x100;
c0107aba:	c7 45 dc 00 01 00 00 	movl   $0x100,-0x24(%ebp)
    assert(find_vma(mm, addr) == vma);
c0107ac1:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0107ac4:	89 44 24 04          	mov    %eax,0x4(%esp)
c0107ac8:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0107acb:	89 04 24             	mov    %eax,(%esp)
c0107ace:	e8 d1 f6 ff ff       	call   c01071a4 <find_vma>
c0107ad3:	3b 45 e0             	cmp    -0x20(%ebp),%eax
c0107ad6:	74 24                	je     c0107afc <check_pgfault+0x12c>
c0107ad8:	c7 44 24 0c f1 a6 10 	movl   $0xc010a6f1,0xc(%esp)
c0107adf:	c0 
c0107ae0:	c7 44 24 08 a7 a4 10 	movl   $0xc010a4a7,0x8(%esp)
c0107ae7:	c0 
c0107ae8:	c7 44 24 04 00 01 00 	movl   $0x100,0x4(%esp)
c0107aef:	00 
c0107af0:	c7 04 24 bc a4 10 c0 	movl   $0xc010a4bc,(%esp)
c0107af7:	e8 d9 91 ff ff       	call   c0100cd5 <__panic>

    int i, sum = 0;
c0107afc:	c7 45 f0 00 00 00 00 	movl   $0x0,-0x10(%ebp)
    for (i = 0; i < 100; i ++) {
c0107b03:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
c0107b0a:	eb 17                	jmp    c0107b23 <check_pgfault+0x153>
        *(char *)(addr + i) = i;
c0107b0c:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0107b0f:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0107b12:	01 d0                	add    %edx,%eax
c0107b14:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0107b17:	88 10                	mov    %dl,(%eax)
        sum += i;
c0107b19:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107b1c:	01 45 f0             	add    %eax,-0x10(%ebp)

    uintptr_t addr = 0x100;
    assert(find_vma(mm, addr) == vma);

    int i, sum = 0;
    for (i = 0; i < 100; i ++) {
c0107b1f:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
c0107b23:	83 7d f4 63          	cmpl   $0x63,-0xc(%ebp)
c0107b27:	7e e3                	jle    c0107b0c <check_pgfault+0x13c>
        *(char *)(addr + i) = i;
        sum += i;
    }
    for (i = 0; i < 100; i ++) {
c0107b29:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
c0107b30:	eb 15                	jmp    c0107b47 <check_pgfault+0x177>
        sum -= *(char *)(addr + i);
c0107b32:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0107b35:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0107b38:	01 d0                	add    %edx,%eax
c0107b3a:	0f b6 00             	movzbl (%eax),%eax
c0107b3d:	0f be c0             	movsbl %al,%eax
c0107b40:	29 45 f0             	sub    %eax,-0x10(%ebp)
    int i, sum = 0;
    for (i = 0; i < 100; i ++) {
        *(char *)(addr + i) = i;
        sum += i;
    }
    for (i = 0; i < 100; i ++) {
c0107b43:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
c0107b47:	83 7d f4 63          	cmpl   $0x63,-0xc(%ebp)
c0107b4b:	7e e5                	jle    c0107b32 <check_pgfault+0x162>
        sum -= *(char *)(addr + i);
    }
    assert(sum == 0);
c0107b4d:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c0107b51:	74 24                	je     c0107b77 <check_pgfault+0x1a7>
c0107b53:	c7 44 24 0c 0b a7 10 	movl   $0xc010a70b,0xc(%esp)
c0107b5a:	c0 
c0107b5b:	c7 44 24 08 a7 a4 10 	movl   $0xc010a4a7,0x8(%esp)
c0107b62:	c0 
c0107b63:	c7 44 24 04 0a 01 00 	movl   $0x10a,0x4(%esp)
c0107b6a:	00 
c0107b6b:	c7 04 24 bc a4 10 c0 	movl   $0xc010a4bc,(%esp)
c0107b72:	e8 5e 91 ff ff       	call   c0100cd5 <__panic>

    page_remove(pgdir, ROUNDDOWN(addr, PGSIZE));
c0107b77:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0107b7a:	89 45 d8             	mov    %eax,-0x28(%ebp)
c0107b7d:	8b 45 d8             	mov    -0x28(%ebp),%eax
c0107b80:	25 00 f0 ff ff       	and    $0xfffff000,%eax
c0107b85:	89 44 24 04          	mov    %eax,0x4(%esp)
c0107b89:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0107b8c:	89 04 24             	mov    %eax,(%esp)
c0107b8f:	e8 58 d4 ff ff       	call   c0104fec <page_remove>
    free_page(pa2page(pgdir[0]));
c0107b94:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0107b97:	8b 00                	mov    (%eax),%eax
c0107b99:	89 04 24             	mov    %eax,(%esp)
c0107b9c:	e8 0b f5 ff ff       	call   c01070ac <pa2page>
c0107ba1:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c0107ba8:	00 
c0107ba9:	89 04 24             	mov    %eax,(%esp)
c0107bac:	e8 52 cb ff ff       	call   c0104703 <free_pages>
    pgdir[0] = 0;
c0107bb1:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0107bb4:	c7 00 00 00 00 00    	movl   $0x0,(%eax)

    mm->pgdir = NULL;
c0107bba:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0107bbd:	c7 40 0c 00 00 00 00 	movl   $0x0,0xc(%eax)
    mm_destroy(mm);
c0107bc4:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0107bc7:	89 04 24             	mov    %eax,(%esp)
c0107bca:	e8 5a f8 ff ff       	call   c0107429 <mm_destroy>
    check_mm_struct = NULL;
c0107bcf:	c7 05 ac 1b 12 c0 00 	movl   $0x0,0xc0121bac
c0107bd6:	00 00 00 

    assert(nr_free_pages_store == nr_free_pages());
c0107bd9:	e8 57 cb ff ff       	call   c0104735 <nr_free_pages>
c0107bde:	3b 45 ec             	cmp    -0x14(%ebp),%eax
c0107be1:	74 24                	je     c0107c07 <check_pgfault+0x237>
c0107be3:	c7 44 24 0c 28 a5 10 	movl   $0xc010a528,0xc(%esp)
c0107bea:	c0 
c0107beb:	c7 44 24 08 a7 a4 10 	movl   $0xc010a4a7,0x8(%esp)
c0107bf2:	c0 
c0107bf3:	c7 44 24 04 14 01 00 	movl   $0x114,0x4(%esp)
c0107bfa:	00 
c0107bfb:	c7 04 24 bc a4 10 c0 	movl   $0xc010a4bc,(%esp)
c0107c02:	e8 ce 90 ff ff       	call   c0100cd5 <__panic>

    cprintf("check_pgfault() succeeded!\n");
c0107c07:	c7 04 24 14 a7 10 c0 	movl   $0xc010a714,(%esp)
c0107c0e:	e8 38 87 ff ff       	call   c010034b <cprintf>
}
c0107c13:	c9                   	leave  
c0107c14:	c3                   	ret    

c0107c15 <do_pgfault>:
 *            was a read (0) or write (1).
 *         -- The U/S flag (bit 2) indicates whether the processor was executing at user mode (1)
 *            or supervisor mode (0) at the time of the exception.
 */
int
do_pgfault(struct mm_struct *mm, uint32_t error_code, uintptr_t addr) {
c0107c15:	55                   	push   %ebp
c0107c16:	89 e5                	mov    %esp,%ebp
c0107c18:	83 ec 38             	sub    $0x38,%esp
    int ret = -E_INVAL;
c0107c1b:	c7 45 f4 fd ff ff ff 	movl   $0xfffffffd,-0xc(%ebp)
    //对虚拟地址进行判断，如果虚拟地址的范围超过了限制，或者是虚拟地址无法被查找到，那么可以直接报错。
    struct vma_struct *vma = find_vma(mm, addr);
c0107c22:	8b 45 10             	mov    0x10(%ebp),%eax
c0107c25:	89 44 24 04          	mov    %eax,0x4(%esp)
c0107c29:	8b 45 08             	mov    0x8(%ebp),%eax
c0107c2c:	89 04 24             	mov    %eax,(%esp)
c0107c2f:	e8 70 f5 ff ff       	call   c01071a4 <find_vma>
c0107c34:	89 45 ec             	mov    %eax,-0x14(%ebp)
   //寻找addr对应的vma
    pgfault_num++;  //页异常错误+1
c0107c37:	a1 b8 1a 12 c0       	mov    0xc0121ab8,%eax
c0107c3c:	83 c0 01             	add    $0x1,%eax
c0107c3f:	a3 b8 1a 12 c0       	mov    %eax,0xc0121ab8
    //判断addr是否在vma的范围中或vma是否存在
    if (vma == NULL || vma->vm_start > addr) {
c0107c44:	83 7d ec 00          	cmpl   $0x0,-0x14(%ebp)
c0107c48:	74 0b                	je     c0107c55 <do_pgfault+0x40>
c0107c4a:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0107c4d:	8b 40 04             	mov    0x4(%eax),%eax
c0107c50:	3b 45 10             	cmp    0x10(%ebp),%eax
c0107c53:	76 18                	jbe    c0107c6d <do_pgfault+0x58>
        cprintf("not valid addr %x, and  can not find it in vma\n", addr);
c0107c55:	8b 45 10             	mov    0x10(%ebp),%eax
c0107c58:	89 44 24 04          	mov    %eax,0x4(%esp)
c0107c5c:	c7 04 24 30 a7 10 c0 	movl   $0xc010a730,(%esp)
c0107c63:	e8 e3 86 ff ff       	call   c010034b <cprintf>
        goto failed;
c0107c68:	e9 bb 01 00 00       	jmp    c0107e28 <do_pgfault+0x213>
    //错误类型检查
        /*错误码的低2位分别是：P标志（位0）最低位：表示当前的错误是
        由于不存在页面（0）引起，还是由于违反访问权限（1）引起。
        W / R标志（位1）：表示当前错误是由于读操作（0）
        引起还是还是写操作（1）引起。*/
    switch (error_code & 3) {
c0107c6d:	8b 45 0c             	mov    0xc(%ebp),%eax
c0107c70:	83 e0 03             	and    $0x3,%eax
c0107c73:	85 c0                	test   %eax,%eax
c0107c75:	74 36                	je     c0107cad <do_pgfault+0x98>
c0107c77:	83 f8 01             	cmp    $0x1,%eax
c0107c7a:	74 20                	je     c0107c9c <do_pgfault+0x87>
    default:
            /* error code flag : default is 3 ( W/R=1, P=1): write, present */
    case 2: /* 申请了写操作，但页面根本不存在*/
        if (!(vma->vm_flags & VM_WRITE)) {
c0107c7c:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0107c7f:	8b 40 0c             	mov    0xc(%eax),%eax
c0107c82:	83 e0 02             	and    $0x2,%eax
c0107c85:	85 c0                	test   %eax,%eax
c0107c87:	75 11                	jne    c0107c9a <do_pgfault+0x85>
            cprintf("do_pgfault failed: error code flag = write AND not present, but the addr's vma cannot write\n");
c0107c89:	c7 04 24 60 a7 10 c0 	movl   $0xc010a760,(%esp)
c0107c90:	e8 b6 86 ff ff       	call   c010034b <cprintf>
            goto failed;
c0107c95:	e9 8e 01 00 00       	jmp    c0107e28 <do_pgfault+0x213>
        }
        break;
c0107c9a:	eb 2f                	jmp    c0107ccb <do_pgfault+0xb6>
    case 1: /* 申请读操作，但是权限不够 */
        cprintf("do_pgfault failed: error code flag = read AND present\n");
c0107c9c:	c7 04 24 c0 a7 10 c0 	movl   $0xc010a7c0,(%esp)
c0107ca3:	e8 a3 86 ff ff       	call   c010034b <cprintf>
        goto failed;
c0107ca8:	e9 7b 01 00 00       	jmp    c0107e28 <do_pgfault+0x213>
    case 0: /* 申请读操作，但是页面不存在 */
        if (!(vma->vm_flags & (VM_READ | VM_EXEC))) {
c0107cad:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0107cb0:	8b 40 0c             	mov    0xc(%eax),%eax
c0107cb3:	83 e0 05             	and    $0x5,%eax
c0107cb6:	85 c0                	test   %eax,%eax
c0107cb8:	75 11                	jne    c0107ccb <do_pgfault+0xb6>
            cprintf("do_pgfault failed: error code flag = read AND not present, but the addr's vma cannot read or exec\n");
c0107cba:	c7 04 24 f8 a7 10 c0 	movl   $0xc010a7f8,(%esp)
c0107cc1:	e8 85 86 ff ff       	call   c010034b <cprintf>
            goto failed;
c0107cc6:	e9 5d 01 00 00       	jmp    c0107e28 <do_pgfault+0x213>
     *    (write an non_existed addr && addr is writable) OR
     *    (read  an non_existed addr && addr is readable)
     * THEN
     *    continue process
     */
    uint32_t perm = PTE_U;
c0107ccb:	c7 45 f0 04 00 00 00 	movl   $0x4,-0x10(%ebp)
    if (vma->vm_flags & VM_WRITE) {
c0107cd2:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0107cd5:	8b 40 0c             	mov    0xc(%eax),%eax
c0107cd8:	83 e0 02             	and    $0x2,%eax
c0107cdb:	85 c0                	test   %eax,%eax
c0107cdd:	74 04                	je     c0107ce3 <do_pgfault+0xce>
        perm |= PTE_W;
c0107cdf:	83 4d f0 02          	orl    $0x2,-0x10(%ebp)
    }
    addr = ROUNDDOWN(addr, PGSIZE);
c0107ce3:	8b 45 10             	mov    0x10(%ebp),%eax
c0107ce6:	89 45 e8             	mov    %eax,-0x18(%ebp)
c0107ce9:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0107cec:	25 00 f0 ff ff       	and    $0xfffff000,%eax
c0107cf1:	89 45 10             	mov    %eax,0x10(%ebp)

    ret = -E_NO_MEM;
c0107cf4:	c7 45 f4 fc ff ff ff 	movl   $0xfffffffc,-0xc(%ebp)

    pte_t *ptep=NULL;
c0107cfb:	c7 45 e4 00 00 00 00 	movl   $0x0,-0x1c(%ebp)
    *
    */
//#if 0
    /*LAB3 EXERCISE 1: YOUR CODE*/
           //通过get_pte寻找页表
    if ((ptep = get_pte(mm->pgdir, addr, 1)) == NULL) {
c0107d02:	8b 45 08             	mov    0x8(%ebp),%eax
c0107d05:	8b 40 0c             	mov    0xc(%eax),%eax
c0107d08:	c7 44 24 08 01 00 00 	movl   $0x1,0x8(%esp)
c0107d0f:	00 
c0107d10:	8b 55 10             	mov    0x10(%ebp),%edx
c0107d13:	89 54 24 04          	mov    %edx,0x4(%esp)
c0107d17:	89 04 24             	mov    %eax,(%esp)
c0107d1a:	e8 db d0 ff ff       	call   c0104dfa <get_pte>
c0107d1f:	89 45 e4             	mov    %eax,-0x1c(%ebp)
c0107d22:	83 7d e4 00          	cmpl   $0x0,-0x1c(%ebp)
c0107d26:	75 11                	jne    c0107d39 <do_pgfault+0x124>
    		        cprintf("get_pte in do_pgfault failed\n");
c0107d28:	c7 04 24 5b a8 10 c0 	movl   $0xc010a85b,(%esp)
c0107d2f:	e8 17 86 ff ff       	call   c010034b <cprintf>
    		        goto failed;
c0107d34:	e9 ef 00 00 00       	jmp    c0107e28 <do_pgfault+0x213>
    		    }
    if (*ptep == 0) {//新创建的页表
c0107d39:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0107d3c:	8b 00                	mov    (%eax),%eax
c0107d3e:	85 c0                	test   %eax,%eax
c0107d40:	75 35                	jne    c0107d77 <do_pgfault+0x162>
    	 //初始化建立虚拟地址与物理页之间的映射关系
    	        if (pgdir_alloc_page(mm->pgdir, addr, perm) == NULL) {
c0107d42:	8b 45 08             	mov    0x8(%ebp),%eax
c0107d45:	8b 40 0c             	mov    0xc(%eax),%eax
c0107d48:	8b 55 f0             	mov    -0x10(%ebp),%edx
c0107d4b:	89 54 24 08          	mov    %edx,0x8(%esp)
c0107d4f:	8b 55 10             	mov    0x10(%ebp),%edx
c0107d52:	89 54 24 04          	mov    %edx,0x4(%esp)
c0107d56:	89 04 24             	mov    %eax,(%esp)
c0107d59:	e8 e8 d3 ff ff       	call   c0105146 <pgdir_alloc_page>
c0107d5e:	85 c0                	test   %eax,%eax
c0107d60:	0f 85 bb 00 00 00    	jne    c0107e21 <do_pgfault+0x20c>
    	            //初始化失败报错并退出。
    	            cprintf("pgdir_alloc_page in do_pgfault failed\n");
c0107d66:	c7 04 24 7c a8 10 c0 	movl   $0xc010a87c,(%esp)
c0107d6d:	e8 d9 85 ff ff       	call   c010034b <cprintf>
    	            goto failed;
c0107d72:	e9 b1 00 00 00       	jmp    c0107e28 <do_pgfault+0x213>
    *    swap_in(mm, addr, &page) : alloc a memory page, then according to the swap entry in PTE for addr,
    *                               find the addr of disk page, read the content of disk page into this memroy page
    *    page_insert ： build the map of phy addr of an Page with the linear addr la
    *    swap_map_swappable ： set the page swappable
    */
        if(swap_init_ok) {
c0107d77:	a1 ac 1a 12 c0       	mov    0xc0121aac,%eax
c0107d7c:	85 c0                	test   %eax,%eax
c0107d7e:	0f 84 86 00 00 00    	je     c0107e0a <do_pgfault+0x1f5>
        	 struct Page *page=NULL; //根据mm结构和addr地址，尝试将硬盘中的内容换入至page中
c0107d84:	c7 45 e0 00 00 00 00 	movl   $0x0,-0x20(%ebp)
        	if ((ret = swap_in(mm, addr, &page)) != 0) {//否则失败
c0107d8b:	8d 45 e0             	lea    -0x20(%ebp),%eax
c0107d8e:	89 44 24 08          	mov    %eax,0x8(%esp)
c0107d92:	8b 45 10             	mov    0x10(%ebp),%eax
c0107d95:	89 44 24 04          	mov    %eax,0x4(%esp)
c0107d99:	8b 45 08             	mov    0x8(%ebp),%eax
c0107d9c:	89 04 24             	mov    %eax,(%esp)
c0107d9f:	e8 6c e5 ff ff       	call   c0106310 <swap_in>
c0107da4:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0107da7:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0107dab:	74 0e                	je     c0107dbb <do_pgfault+0x1a6>
        	cprintf("swap_in in do_pgfault failed\n");
c0107dad:	c7 04 24 a3 a8 10 c0 	movl   $0xc010a8a3,(%esp)
c0107db4:	e8 92 85 ff ff       	call   c010034b <cprintf>
c0107db9:	eb 6d                	jmp    c0107e28 <do_pgfault+0x213>
        	goto failed;
     }
        	page_insert(mm->pgdir, page, addr, perm); //建立虚拟地址和物理地址之间的对应关系
c0107dbb:	8b 55 e0             	mov    -0x20(%ebp),%edx
c0107dbe:	8b 45 08             	mov    0x8(%ebp),%eax
c0107dc1:	8b 40 0c             	mov    0xc(%eax),%eax
c0107dc4:	8b 4d f0             	mov    -0x10(%ebp),%ecx
c0107dc7:	89 4c 24 0c          	mov    %ecx,0xc(%esp)
c0107dcb:	8b 4d 10             	mov    0x10(%ebp),%ecx
c0107dce:	89 4c 24 08          	mov    %ecx,0x8(%esp)
c0107dd2:	89 54 24 04          	mov    %edx,0x4(%esp)
c0107dd6:	89 04 24             	mov    %eax,(%esp)
c0107dd9:	e8 52 d2 ff ff       	call   c0105030 <page_insert>
        	swap_map_swappable(mm, addr, page, 1); //将此页面设置为可交换的
c0107dde:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0107de1:	c7 44 24 0c 01 00 00 	movl   $0x1,0xc(%esp)
c0107de8:	00 
c0107de9:	89 44 24 08          	mov    %eax,0x8(%esp)
c0107ded:	8b 45 10             	mov    0x10(%ebp),%eax
c0107df0:	89 44 24 04          	mov    %eax,0x4(%esp)
c0107df4:	8b 45 08             	mov    0x8(%ebp),%eax
c0107df7:	89 04 24             	mov    %eax,(%esp)
c0107dfa:	e8 48 e3 ff ff       	call   c0106147 <swap_map_swappable>
        	page->pra_vaddr = addr;
c0107dff:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0107e02:	8b 55 10             	mov    0x10(%ebp),%edx
c0107e05:	89 50 1c             	mov    %edx,0x1c(%eax)
c0107e08:	eb 17                	jmp    c0107e21 <do_pgfault+0x20c>
        }
        else {
            cprintf("no swap_init_ok but ptep is %x, failed\n",*ptep);
c0107e0a:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0107e0d:	8b 00                	mov    (%eax),%eax
c0107e0f:	89 44 24 04          	mov    %eax,0x4(%esp)
c0107e13:	c7 04 24 c4 a8 10 c0 	movl   $0xc010a8c4,(%esp)
c0107e1a:	e8 2c 85 ff ff       	call   c010034b <cprintf>
            goto failed;
c0107e1f:	eb 07                	jmp    c0107e28 <do_pgfault+0x213>
        }
   }
//#endif
   ret = 0;
c0107e21:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
failed:
    return ret;
c0107e28:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c0107e2b:	c9                   	leave  
c0107e2c:	c3                   	ret    

c0107e2d <page2ppn>:

extern struct Page *pages;
extern size_t npage;

static inline ppn_t
page2ppn(struct Page *page) {
c0107e2d:	55                   	push   %ebp
c0107e2e:	89 e5                	mov    %esp,%ebp
    return page - pages;
c0107e30:	8b 55 08             	mov    0x8(%ebp),%edx
c0107e33:	a1 d4 1a 12 c0       	mov    0xc0121ad4,%eax
c0107e38:	29 c2                	sub    %eax,%edx
c0107e3a:	89 d0                	mov    %edx,%eax
c0107e3c:	c1 f8 05             	sar    $0x5,%eax
}
c0107e3f:	5d                   	pop    %ebp
c0107e40:	c3                   	ret    

c0107e41 <page2pa>:

static inline uintptr_t
page2pa(struct Page *page) {
c0107e41:	55                   	push   %ebp
c0107e42:	89 e5                	mov    %esp,%ebp
c0107e44:	83 ec 04             	sub    $0x4,%esp
    return page2ppn(page) << PGSHIFT;
c0107e47:	8b 45 08             	mov    0x8(%ebp),%eax
c0107e4a:	89 04 24             	mov    %eax,(%esp)
c0107e4d:	e8 db ff ff ff       	call   c0107e2d <page2ppn>
c0107e52:	c1 e0 0c             	shl    $0xc,%eax
}
c0107e55:	c9                   	leave  
c0107e56:	c3                   	ret    

c0107e57 <page2kva>:
    }
    return &pages[PPN(pa)];
}

static inline void *
page2kva(struct Page *page) {
c0107e57:	55                   	push   %ebp
c0107e58:	89 e5                	mov    %esp,%ebp
c0107e5a:	83 ec 28             	sub    $0x28,%esp
    return KADDR(page2pa(page));
c0107e5d:	8b 45 08             	mov    0x8(%ebp),%eax
c0107e60:	89 04 24             	mov    %eax,(%esp)
c0107e63:	e8 d9 ff ff ff       	call   c0107e41 <page2pa>
c0107e68:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0107e6b:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107e6e:	c1 e8 0c             	shr    $0xc,%eax
c0107e71:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0107e74:	a1 20 1a 12 c0       	mov    0xc0121a20,%eax
c0107e79:	39 45 f0             	cmp    %eax,-0x10(%ebp)
c0107e7c:	72 23                	jb     c0107ea1 <page2kva+0x4a>
c0107e7e:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107e81:	89 44 24 0c          	mov    %eax,0xc(%esp)
c0107e85:	c7 44 24 08 ec a8 10 	movl   $0xc010a8ec,0x8(%esp)
c0107e8c:	c0 
c0107e8d:	c7 44 24 04 62 00 00 	movl   $0x62,0x4(%esp)
c0107e94:	00 
c0107e95:	c7 04 24 0f a9 10 c0 	movl   $0xc010a90f,(%esp)
c0107e9c:	e8 34 8e ff ff       	call   c0100cd5 <__panic>
c0107ea1:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107ea4:	2d 00 00 00 40       	sub    $0x40000000,%eax
}
c0107ea9:	c9                   	leave  
c0107eaa:	c3                   	ret    

c0107eab <swapfs_init>:
#include <ide.h>
#include <pmm.h>
#include <assert.h>

void
swapfs_init(void) {
c0107eab:	55                   	push   %ebp
c0107eac:	89 e5                	mov    %esp,%ebp
c0107eae:	83 ec 18             	sub    $0x18,%esp
    static_assert((PGSIZE % SECTSIZE) == 0);
    if (!ide_device_valid(SWAP_DEV_NO)) {
c0107eb1:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0107eb8:	e8 68 9b ff ff       	call   c0101a25 <ide_device_valid>
c0107ebd:	85 c0                	test   %eax,%eax
c0107ebf:	75 1c                	jne    c0107edd <swapfs_init+0x32>
        panic("swap fs isn't available.\n");
c0107ec1:	c7 44 24 08 1d a9 10 	movl   $0xc010a91d,0x8(%esp)
c0107ec8:	c0 
c0107ec9:	c7 44 24 04 0d 00 00 	movl   $0xd,0x4(%esp)
c0107ed0:	00 
c0107ed1:	c7 04 24 37 a9 10 c0 	movl   $0xc010a937,(%esp)
c0107ed8:	e8 f8 8d ff ff       	call   c0100cd5 <__panic>
    }
    max_swap_offset = ide_device_size(SWAP_DEV_NO) / (PGSIZE / SECTSIZE);
c0107edd:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0107ee4:	e8 7b 9b ff ff       	call   c0101a64 <ide_device_size>
c0107ee9:	c1 e8 03             	shr    $0x3,%eax
c0107eec:	a3 7c 1b 12 c0       	mov    %eax,0xc0121b7c
}
c0107ef1:	c9                   	leave  
c0107ef2:	c3                   	ret    

c0107ef3 <swapfs_read>:

int
swapfs_read(swap_entry_t entry, struct Page *page) {
c0107ef3:	55                   	push   %ebp
c0107ef4:	89 e5                	mov    %esp,%ebp
c0107ef6:	83 ec 28             	sub    $0x28,%esp
    return ide_read_secs(SWAP_DEV_NO, swap_offset(entry) * PAGE_NSECT, page2kva(page), PAGE_NSECT);
c0107ef9:	8b 45 0c             	mov    0xc(%ebp),%eax
c0107efc:	89 04 24             	mov    %eax,(%esp)
c0107eff:	e8 53 ff ff ff       	call   c0107e57 <page2kva>
c0107f04:	8b 55 08             	mov    0x8(%ebp),%edx
c0107f07:	c1 ea 08             	shr    $0x8,%edx
c0107f0a:	89 55 f4             	mov    %edx,-0xc(%ebp)
c0107f0d:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0107f11:	74 0b                	je     c0107f1e <swapfs_read+0x2b>
c0107f13:	8b 15 7c 1b 12 c0    	mov    0xc0121b7c,%edx
c0107f19:	39 55 f4             	cmp    %edx,-0xc(%ebp)
c0107f1c:	72 23                	jb     c0107f41 <swapfs_read+0x4e>
c0107f1e:	8b 45 08             	mov    0x8(%ebp),%eax
c0107f21:	89 44 24 0c          	mov    %eax,0xc(%esp)
c0107f25:	c7 44 24 08 48 a9 10 	movl   $0xc010a948,0x8(%esp)
c0107f2c:	c0 
c0107f2d:	c7 44 24 04 14 00 00 	movl   $0x14,0x4(%esp)
c0107f34:	00 
c0107f35:	c7 04 24 37 a9 10 c0 	movl   $0xc010a937,(%esp)
c0107f3c:	e8 94 8d ff ff       	call   c0100cd5 <__panic>
c0107f41:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0107f44:	c1 e2 03             	shl    $0x3,%edx
c0107f47:	c7 44 24 0c 08 00 00 	movl   $0x8,0xc(%esp)
c0107f4e:	00 
c0107f4f:	89 44 24 08          	mov    %eax,0x8(%esp)
c0107f53:	89 54 24 04          	mov    %edx,0x4(%esp)
c0107f57:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0107f5e:	e8 40 9b ff ff       	call   c0101aa3 <ide_read_secs>
}
c0107f63:	c9                   	leave  
c0107f64:	c3                   	ret    

c0107f65 <swapfs_write>:

int
swapfs_write(swap_entry_t entry, struct Page *page) {
c0107f65:	55                   	push   %ebp
c0107f66:	89 e5                	mov    %esp,%ebp
c0107f68:	83 ec 28             	sub    $0x28,%esp
    return ide_write_secs(SWAP_DEV_NO, swap_offset(entry) * PAGE_NSECT, page2kva(page), PAGE_NSECT);
c0107f6b:	8b 45 0c             	mov    0xc(%ebp),%eax
c0107f6e:	89 04 24             	mov    %eax,(%esp)
c0107f71:	e8 e1 fe ff ff       	call   c0107e57 <page2kva>
c0107f76:	8b 55 08             	mov    0x8(%ebp),%edx
c0107f79:	c1 ea 08             	shr    $0x8,%edx
c0107f7c:	89 55 f4             	mov    %edx,-0xc(%ebp)
c0107f7f:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0107f83:	74 0b                	je     c0107f90 <swapfs_write+0x2b>
c0107f85:	8b 15 7c 1b 12 c0    	mov    0xc0121b7c,%edx
c0107f8b:	39 55 f4             	cmp    %edx,-0xc(%ebp)
c0107f8e:	72 23                	jb     c0107fb3 <swapfs_write+0x4e>
c0107f90:	8b 45 08             	mov    0x8(%ebp),%eax
c0107f93:	89 44 24 0c          	mov    %eax,0xc(%esp)
c0107f97:	c7 44 24 08 48 a9 10 	movl   $0xc010a948,0x8(%esp)
c0107f9e:	c0 
c0107f9f:	c7 44 24 04 19 00 00 	movl   $0x19,0x4(%esp)
c0107fa6:	00 
c0107fa7:	c7 04 24 37 a9 10 c0 	movl   $0xc010a937,(%esp)
c0107fae:	e8 22 8d ff ff       	call   c0100cd5 <__panic>
c0107fb3:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0107fb6:	c1 e2 03             	shl    $0x3,%edx
c0107fb9:	c7 44 24 0c 08 00 00 	movl   $0x8,0xc(%esp)
c0107fc0:	00 
c0107fc1:	89 44 24 08          	mov    %eax,0x8(%esp)
c0107fc5:	89 54 24 04          	mov    %edx,0x4(%esp)
c0107fc9:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0107fd0:	e8 10 9d ff ff       	call   c0101ce5 <ide_write_secs>
}
c0107fd5:	c9                   	leave  
c0107fd6:	c3                   	ret    

c0107fd7 <printnum>:
 * @width:      maximum number of digits, if the actual width is less than @width, use @padc instead
 * @padc:       character that padded on the left if the actual width is less than @width
 * */
static void
printnum(void (*putch)(int, void*), void *putdat,
        unsigned long long num, unsigned base, int width, int padc) {
c0107fd7:	55                   	push   %ebp
c0107fd8:	89 e5                	mov    %esp,%ebp
c0107fda:	83 ec 58             	sub    $0x58,%esp
c0107fdd:	8b 45 10             	mov    0x10(%ebp),%eax
c0107fe0:	89 45 d0             	mov    %eax,-0x30(%ebp)
c0107fe3:	8b 45 14             	mov    0x14(%ebp),%eax
c0107fe6:	89 45 d4             	mov    %eax,-0x2c(%ebp)
    unsigned long long result = num;
c0107fe9:	8b 45 d0             	mov    -0x30(%ebp),%eax
c0107fec:	8b 55 d4             	mov    -0x2c(%ebp),%edx
c0107fef:	89 45 e8             	mov    %eax,-0x18(%ebp)
c0107ff2:	89 55 ec             	mov    %edx,-0x14(%ebp)
    unsigned mod = do_div(result, base);
c0107ff5:	8b 45 18             	mov    0x18(%ebp),%eax
c0107ff8:	89 45 e4             	mov    %eax,-0x1c(%ebp)
c0107ffb:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0107ffe:	8b 55 ec             	mov    -0x14(%ebp),%edx
c0108001:	89 45 e0             	mov    %eax,-0x20(%ebp)
c0108004:	89 55 f0             	mov    %edx,-0x10(%ebp)
c0108007:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010800a:	89 45 f4             	mov    %eax,-0xc(%ebp)
c010800d:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c0108011:	74 1c                	je     c010802f <printnum+0x58>
c0108013:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0108016:	ba 00 00 00 00       	mov    $0x0,%edx
c010801b:	f7 75 e4             	divl   -0x1c(%ebp)
c010801e:	89 55 f4             	mov    %edx,-0xc(%ebp)
c0108021:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0108024:	ba 00 00 00 00       	mov    $0x0,%edx
c0108029:	f7 75 e4             	divl   -0x1c(%ebp)
c010802c:	89 45 f0             	mov    %eax,-0x10(%ebp)
c010802f:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0108032:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0108035:	f7 75 e4             	divl   -0x1c(%ebp)
c0108038:	89 45 e0             	mov    %eax,-0x20(%ebp)
c010803b:	89 55 dc             	mov    %edx,-0x24(%ebp)
c010803e:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0108041:	8b 55 f0             	mov    -0x10(%ebp),%edx
c0108044:	89 45 e8             	mov    %eax,-0x18(%ebp)
c0108047:	89 55 ec             	mov    %edx,-0x14(%ebp)
c010804a:	8b 45 dc             	mov    -0x24(%ebp),%eax
c010804d:	89 45 d8             	mov    %eax,-0x28(%ebp)

    // first recursively print all preceding (more significant) digits
    if (num >= base) {
c0108050:	8b 45 18             	mov    0x18(%ebp),%eax
c0108053:	ba 00 00 00 00       	mov    $0x0,%edx
c0108058:	3b 55 d4             	cmp    -0x2c(%ebp),%edx
c010805b:	77 56                	ja     c01080b3 <printnum+0xdc>
c010805d:	3b 55 d4             	cmp    -0x2c(%ebp),%edx
c0108060:	72 05                	jb     c0108067 <printnum+0x90>
c0108062:	3b 45 d0             	cmp    -0x30(%ebp),%eax
c0108065:	77 4c                	ja     c01080b3 <printnum+0xdc>
        printnum(putch, putdat, result, base, width - 1, padc);
c0108067:	8b 45 1c             	mov    0x1c(%ebp),%eax
c010806a:	8d 50 ff             	lea    -0x1(%eax),%edx
c010806d:	8b 45 20             	mov    0x20(%ebp),%eax
c0108070:	89 44 24 18          	mov    %eax,0x18(%esp)
c0108074:	89 54 24 14          	mov    %edx,0x14(%esp)
c0108078:	8b 45 18             	mov    0x18(%ebp),%eax
c010807b:	89 44 24 10          	mov    %eax,0x10(%esp)
c010807f:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0108082:	8b 55 ec             	mov    -0x14(%ebp),%edx
c0108085:	89 44 24 08          	mov    %eax,0x8(%esp)
c0108089:	89 54 24 0c          	mov    %edx,0xc(%esp)
c010808d:	8b 45 0c             	mov    0xc(%ebp),%eax
c0108090:	89 44 24 04          	mov    %eax,0x4(%esp)
c0108094:	8b 45 08             	mov    0x8(%ebp),%eax
c0108097:	89 04 24             	mov    %eax,(%esp)
c010809a:	e8 38 ff ff ff       	call   c0107fd7 <printnum>
c010809f:	eb 1c                	jmp    c01080bd <printnum+0xe6>
    } else {
        // print any needed pad characters before first digit
        while (-- width > 0)
            putch(padc, putdat);
c01080a1:	8b 45 0c             	mov    0xc(%ebp),%eax
c01080a4:	89 44 24 04          	mov    %eax,0x4(%esp)
c01080a8:	8b 45 20             	mov    0x20(%ebp),%eax
c01080ab:	89 04 24             	mov    %eax,(%esp)
c01080ae:	8b 45 08             	mov    0x8(%ebp),%eax
c01080b1:	ff d0                	call   *%eax
    // first recursively print all preceding (more significant) digits
    if (num >= base) {
        printnum(putch, putdat, result, base, width - 1, padc);
    } else {
        // print any needed pad characters before first digit
        while (-- width > 0)
c01080b3:	83 6d 1c 01          	subl   $0x1,0x1c(%ebp)
c01080b7:	83 7d 1c 00          	cmpl   $0x0,0x1c(%ebp)
c01080bb:	7f e4                	jg     c01080a1 <printnum+0xca>
            putch(padc, putdat);
    }
    // then print this (the least significant) digit
    putch("0123456789abcdef"[mod], putdat);
c01080bd:	8b 45 d8             	mov    -0x28(%ebp),%eax
c01080c0:	05 e8 a9 10 c0       	add    $0xc010a9e8,%eax
c01080c5:	0f b6 00             	movzbl (%eax),%eax
c01080c8:	0f be c0             	movsbl %al,%eax
c01080cb:	8b 55 0c             	mov    0xc(%ebp),%edx
c01080ce:	89 54 24 04          	mov    %edx,0x4(%esp)
c01080d2:	89 04 24             	mov    %eax,(%esp)
c01080d5:	8b 45 08             	mov    0x8(%ebp),%eax
c01080d8:	ff d0                	call   *%eax
}
c01080da:	c9                   	leave  
c01080db:	c3                   	ret    

c01080dc <getuint>:
 * getuint - get an unsigned int of various possible sizes from a varargs list
 * @ap:         a varargs list pointer
 * @lflag:      determines the size of the vararg that @ap points to
 * */
static unsigned long long
getuint(va_list *ap, int lflag) {
c01080dc:	55                   	push   %ebp
c01080dd:	89 e5                	mov    %esp,%ebp
    if (lflag >= 2) {
c01080df:	83 7d 0c 01          	cmpl   $0x1,0xc(%ebp)
c01080e3:	7e 14                	jle    c01080f9 <getuint+0x1d>
        return va_arg(*ap, unsigned long long);
c01080e5:	8b 45 08             	mov    0x8(%ebp),%eax
c01080e8:	8b 00                	mov    (%eax),%eax
c01080ea:	8d 48 08             	lea    0x8(%eax),%ecx
c01080ed:	8b 55 08             	mov    0x8(%ebp),%edx
c01080f0:	89 0a                	mov    %ecx,(%edx)
c01080f2:	8b 50 04             	mov    0x4(%eax),%edx
c01080f5:	8b 00                	mov    (%eax),%eax
c01080f7:	eb 30                	jmp    c0108129 <getuint+0x4d>
    }
    else if (lflag) {
c01080f9:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
c01080fd:	74 16                	je     c0108115 <getuint+0x39>
        return va_arg(*ap, unsigned long);
c01080ff:	8b 45 08             	mov    0x8(%ebp),%eax
c0108102:	8b 00                	mov    (%eax),%eax
c0108104:	8d 48 04             	lea    0x4(%eax),%ecx
c0108107:	8b 55 08             	mov    0x8(%ebp),%edx
c010810a:	89 0a                	mov    %ecx,(%edx)
c010810c:	8b 00                	mov    (%eax),%eax
c010810e:	ba 00 00 00 00       	mov    $0x0,%edx
c0108113:	eb 14                	jmp    c0108129 <getuint+0x4d>
    }
    else {
        return va_arg(*ap, unsigned int);
c0108115:	8b 45 08             	mov    0x8(%ebp),%eax
c0108118:	8b 00                	mov    (%eax),%eax
c010811a:	8d 48 04             	lea    0x4(%eax),%ecx
c010811d:	8b 55 08             	mov    0x8(%ebp),%edx
c0108120:	89 0a                	mov    %ecx,(%edx)
c0108122:	8b 00                	mov    (%eax),%eax
c0108124:	ba 00 00 00 00       	mov    $0x0,%edx
    }
}
c0108129:	5d                   	pop    %ebp
c010812a:	c3                   	ret    

c010812b <getint>:
 * getint - same as getuint but signed, we can't use getuint because of sign extension
 * @ap:         a varargs list pointer
 * @lflag:      determines the size of the vararg that @ap points to
 * */
static long long
getint(va_list *ap, int lflag) {
c010812b:	55                   	push   %ebp
c010812c:	89 e5                	mov    %esp,%ebp
    if (lflag >= 2) {
c010812e:	83 7d 0c 01          	cmpl   $0x1,0xc(%ebp)
c0108132:	7e 14                	jle    c0108148 <getint+0x1d>
        return va_arg(*ap, long long);
c0108134:	8b 45 08             	mov    0x8(%ebp),%eax
c0108137:	8b 00                	mov    (%eax),%eax
c0108139:	8d 48 08             	lea    0x8(%eax),%ecx
c010813c:	8b 55 08             	mov    0x8(%ebp),%edx
c010813f:	89 0a                	mov    %ecx,(%edx)
c0108141:	8b 50 04             	mov    0x4(%eax),%edx
c0108144:	8b 00                	mov    (%eax),%eax
c0108146:	eb 28                	jmp    c0108170 <getint+0x45>
    }
    else if (lflag) {
c0108148:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
c010814c:	74 12                	je     c0108160 <getint+0x35>
        return va_arg(*ap, long);
c010814e:	8b 45 08             	mov    0x8(%ebp),%eax
c0108151:	8b 00                	mov    (%eax),%eax
c0108153:	8d 48 04             	lea    0x4(%eax),%ecx
c0108156:	8b 55 08             	mov    0x8(%ebp),%edx
c0108159:	89 0a                	mov    %ecx,(%edx)
c010815b:	8b 00                	mov    (%eax),%eax
c010815d:	99                   	cltd   
c010815e:	eb 10                	jmp    c0108170 <getint+0x45>
    }
    else {
        return va_arg(*ap, int);
c0108160:	8b 45 08             	mov    0x8(%ebp),%eax
c0108163:	8b 00                	mov    (%eax),%eax
c0108165:	8d 48 04             	lea    0x4(%eax),%ecx
c0108168:	8b 55 08             	mov    0x8(%ebp),%edx
c010816b:	89 0a                	mov    %ecx,(%edx)
c010816d:	8b 00                	mov    (%eax),%eax
c010816f:	99                   	cltd   
    }
}
c0108170:	5d                   	pop    %ebp
c0108171:	c3                   	ret    

c0108172 <printfmt>:
 * @putch:      specified putch function, print a single character
 * @putdat:     used by @putch function
 * @fmt:        the format string to use
 * */
void
printfmt(void (*putch)(int, void*), void *putdat, const char *fmt, ...) {
c0108172:	55                   	push   %ebp
c0108173:	89 e5                	mov    %esp,%ebp
c0108175:	83 ec 28             	sub    $0x28,%esp
    va_list ap;

    va_start(ap, fmt);
c0108178:	8d 45 14             	lea    0x14(%ebp),%eax
c010817b:	89 45 f4             	mov    %eax,-0xc(%ebp)
    vprintfmt(putch, putdat, fmt, ap);
c010817e:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0108181:	89 44 24 0c          	mov    %eax,0xc(%esp)
c0108185:	8b 45 10             	mov    0x10(%ebp),%eax
c0108188:	89 44 24 08          	mov    %eax,0x8(%esp)
c010818c:	8b 45 0c             	mov    0xc(%ebp),%eax
c010818f:	89 44 24 04          	mov    %eax,0x4(%esp)
c0108193:	8b 45 08             	mov    0x8(%ebp),%eax
c0108196:	89 04 24             	mov    %eax,(%esp)
c0108199:	e8 02 00 00 00       	call   c01081a0 <vprintfmt>
    va_end(ap);
}
c010819e:	c9                   	leave  
c010819f:	c3                   	ret    

c01081a0 <vprintfmt>:
 *
 * Call this function if you are already dealing with a va_list.
 * Or you probably want printfmt() instead.
 * */
void
vprintfmt(void (*putch)(int, void*), void *putdat, const char *fmt, va_list ap) {
c01081a0:	55                   	push   %ebp
c01081a1:	89 e5                	mov    %esp,%ebp
c01081a3:	56                   	push   %esi
c01081a4:	53                   	push   %ebx
c01081a5:	83 ec 40             	sub    $0x40,%esp
    register int ch, err;
    unsigned long long num;
    int base, width, precision, lflag, altflag;

    while (1) {
        while ((ch = *(unsigned char *)fmt ++) != '%') {
c01081a8:	eb 18                	jmp    c01081c2 <vprintfmt+0x22>
            if (ch == '\0') {
c01081aa:	85 db                	test   %ebx,%ebx
c01081ac:	75 05                	jne    c01081b3 <vprintfmt+0x13>
                return;
c01081ae:	e9 d1 03 00 00       	jmp    c0108584 <vprintfmt+0x3e4>
            }
            putch(ch, putdat);
c01081b3:	8b 45 0c             	mov    0xc(%ebp),%eax
c01081b6:	89 44 24 04          	mov    %eax,0x4(%esp)
c01081ba:	89 1c 24             	mov    %ebx,(%esp)
c01081bd:	8b 45 08             	mov    0x8(%ebp),%eax
c01081c0:	ff d0                	call   *%eax
    register int ch, err;
    unsigned long long num;
    int base, width, precision, lflag, altflag;

    while (1) {
        while ((ch = *(unsigned char *)fmt ++) != '%') {
c01081c2:	8b 45 10             	mov    0x10(%ebp),%eax
c01081c5:	8d 50 01             	lea    0x1(%eax),%edx
c01081c8:	89 55 10             	mov    %edx,0x10(%ebp)
c01081cb:	0f b6 00             	movzbl (%eax),%eax
c01081ce:	0f b6 d8             	movzbl %al,%ebx
c01081d1:	83 fb 25             	cmp    $0x25,%ebx
c01081d4:	75 d4                	jne    c01081aa <vprintfmt+0xa>
            }
            putch(ch, putdat);
        }

        // Process a %-escape sequence
        char padc = ' ';
c01081d6:	c6 45 db 20          	movb   $0x20,-0x25(%ebp)
        width = precision = -1;
c01081da:	c7 45 e4 ff ff ff ff 	movl   $0xffffffff,-0x1c(%ebp)
c01081e1:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c01081e4:	89 45 e8             	mov    %eax,-0x18(%ebp)
        lflag = altflag = 0;
c01081e7:	c7 45 dc 00 00 00 00 	movl   $0x0,-0x24(%ebp)
c01081ee:	8b 45 dc             	mov    -0x24(%ebp),%eax
c01081f1:	89 45 e0             	mov    %eax,-0x20(%ebp)

    reswitch:
        switch (ch = *(unsigned char *)fmt ++) {
c01081f4:	8b 45 10             	mov    0x10(%ebp),%eax
c01081f7:	8d 50 01             	lea    0x1(%eax),%edx
c01081fa:	89 55 10             	mov    %edx,0x10(%ebp)
c01081fd:	0f b6 00             	movzbl (%eax),%eax
c0108200:	0f b6 d8             	movzbl %al,%ebx
c0108203:	8d 43 dd             	lea    -0x23(%ebx),%eax
c0108206:	83 f8 55             	cmp    $0x55,%eax
c0108209:	0f 87 44 03 00 00    	ja     c0108553 <vprintfmt+0x3b3>
c010820f:	8b 04 85 0c aa 10 c0 	mov    -0x3fef55f4(,%eax,4),%eax
c0108216:	ff e0                	jmp    *%eax

        // flag to pad on the right
        case '-':
            padc = '-';
c0108218:	c6 45 db 2d          	movb   $0x2d,-0x25(%ebp)
            goto reswitch;
c010821c:	eb d6                	jmp    c01081f4 <vprintfmt+0x54>

        // flag to pad with 0's instead of spaces
        case '0':
            padc = '0';
c010821e:	c6 45 db 30          	movb   $0x30,-0x25(%ebp)
            goto reswitch;
c0108222:	eb d0                	jmp    c01081f4 <vprintfmt+0x54>

        // width field
        case '1' ... '9':
            for (precision = 0; ; ++ fmt) {
c0108224:	c7 45 e4 00 00 00 00 	movl   $0x0,-0x1c(%ebp)
                precision = precision * 10 + ch - '0';
c010822b:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c010822e:	89 d0                	mov    %edx,%eax
c0108230:	c1 e0 02             	shl    $0x2,%eax
c0108233:	01 d0                	add    %edx,%eax
c0108235:	01 c0                	add    %eax,%eax
c0108237:	01 d8                	add    %ebx,%eax
c0108239:	83 e8 30             	sub    $0x30,%eax
c010823c:	89 45 e4             	mov    %eax,-0x1c(%ebp)
                ch = *fmt;
c010823f:	8b 45 10             	mov    0x10(%ebp),%eax
c0108242:	0f b6 00             	movzbl (%eax),%eax
c0108245:	0f be d8             	movsbl %al,%ebx
                if (ch < '0' || ch > '9') {
c0108248:	83 fb 2f             	cmp    $0x2f,%ebx
c010824b:	7e 0b                	jle    c0108258 <vprintfmt+0xb8>
c010824d:	83 fb 39             	cmp    $0x39,%ebx
c0108250:	7f 06                	jg     c0108258 <vprintfmt+0xb8>
            padc = '0';
            goto reswitch;

        // width field
        case '1' ... '9':
            for (precision = 0; ; ++ fmt) {
c0108252:	83 45 10 01          	addl   $0x1,0x10(%ebp)
                precision = precision * 10 + ch - '0';
                ch = *fmt;
                if (ch < '0' || ch > '9') {
                    break;
                }
            }
c0108256:	eb d3                	jmp    c010822b <vprintfmt+0x8b>
            goto process_precision;
c0108258:	eb 33                	jmp    c010828d <vprintfmt+0xed>

        case '*':
            precision = va_arg(ap, int);
c010825a:	8b 45 14             	mov    0x14(%ebp),%eax
c010825d:	8d 50 04             	lea    0x4(%eax),%edx
c0108260:	89 55 14             	mov    %edx,0x14(%ebp)
c0108263:	8b 00                	mov    (%eax),%eax
c0108265:	89 45 e4             	mov    %eax,-0x1c(%ebp)
            goto process_precision;
c0108268:	eb 23                	jmp    c010828d <vprintfmt+0xed>

        case '.':
            if (width < 0)
c010826a:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
c010826e:	79 0c                	jns    c010827c <vprintfmt+0xdc>
                width = 0;
c0108270:	c7 45 e8 00 00 00 00 	movl   $0x0,-0x18(%ebp)
            goto reswitch;
c0108277:	e9 78 ff ff ff       	jmp    c01081f4 <vprintfmt+0x54>
c010827c:	e9 73 ff ff ff       	jmp    c01081f4 <vprintfmt+0x54>

        case '#':
            altflag = 1;
c0108281:	c7 45 dc 01 00 00 00 	movl   $0x1,-0x24(%ebp)
            goto reswitch;
c0108288:	e9 67 ff ff ff       	jmp    c01081f4 <vprintfmt+0x54>

        process_precision:
            if (width < 0)
c010828d:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
c0108291:	79 12                	jns    c01082a5 <vprintfmt+0x105>
                width = precision, precision = -1;
c0108293:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0108296:	89 45 e8             	mov    %eax,-0x18(%ebp)
c0108299:	c7 45 e4 ff ff ff ff 	movl   $0xffffffff,-0x1c(%ebp)
            goto reswitch;
c01082a0:	e9 4f ff ff ff       	jmp    c01081f4 <vprintfmt+0x54>
c01082a5:	e9 4a ff ff ff       	jmp    c01081f4 <vprintfmt+0x54>

        // long flag (doubled for long long)
        case 'l':
            lflag ++;
c01082aa:	83 45 e0 01          	addl   $0x1,-0x20(%ebp)
            goto reswitch;
c01082ae:	e9 41 ff ff ff       	jmp    c01081f4 <vprintfmt+0x54>

        // character
        case 'c':
            putch(va_arg(ap, int), putdat);
c01082b3:	8b 45 14             	mov    0x14(%ebp),%eax
c01082b6:	8d 50 04             	lea    0x4(%eax),%edx
c01082b9:	89 55 14             	mov    %edx,0x14(%ebp)
c01082bc:	8b 00                	mov    (%eax),%eax
c01082be:	8b 55 0c             	mov    0xc(%ebp),%edx
c01082c1:	89 54 24 04          	mov    %edx,0x4(%esp)
c01082c5:	89 04 24             	mov    %eax,(%esp)
c01082c8:	8b 45 08             	mov    0x8(%ebp),%eax
c01082cb:	ff d0                	call   *%eax
            break;
c01082cd:	e9 ac 02 00 00       	jmp    c010857e <vprintfmt+0x3de>

        // error message
        case 'e':
            err = va_arg(ap, int);
c01082d2:	8b 45 14             	mov    0x14(%ebp),%eax
c01082d5:	8d 50 04             	lea    0x4(%eax),%edx
c01082d8:	89 55 14             	mov    %edx,0x14(%ebp)
c01082db:	8b 18                	mov    (%eax),%ebx
            if (err < 0) {
c01082dd:	85 db                	test   %ebx,%ebx
c01082df:	79 02                	jns    c01082e3 <vprintfmt+0x143>
                err = -err;
c01082e1:	f7 db                	neg    %ebx
            }
            if (err > MAXERROR || (p = error_string[err]) == NULL) {
c01082e3:	83 fb 06             	cmp    $0x6,%ebx
c01082e6:	7f 0b                	jg     c01082f3 <vprintfmt+0x153>
c01082e8:	8b 34 9d cc a9 10 c0 	mov    -0x3fef5634(,%ebx,4),%esi
c01082ef:	85 f6                	test   %esi,%esi
c01082f1:	75 23                	jne    c0108316 <vprintfmt+0x176>
                printfmt(putch, putdat, "error %d", err);
c01082f3:	89 5c 24 0c          	mov    %ebx,0xc(%esp)
c01082f7:	c7 44 24 08 f9 a9 10 	movl   $0xc010a9f9,0x8(%esp)
c01082fe:	c0 
c01082ff:	8b 45 0c             	mov    0xc(%ebp),%eax
c0108302:	89 44 24 04          	mov    %eax,0x4(%esp)
c0108306:	8b 45 08             	mov    0x8(%ebp),%eax
c0108309:	89 04 24             	mov    %eax,(%esp)
c010830c:	e8 61 fe ff ff       	call   c0108172 <printfmt>
            }
            else {
                printfmt(putch, putdat, "%s", p);
            }
            break;
c0108311:	e9 68 02 00 00       	jmp    c010857e <vprintfmt+0x3de>
            }
            if (err > MAXERROR || (p = error_string[err]) == NULL) {
                printfmt(putch, putdat, "error %d", err);
            }
            else {
                printfmt(putch, putdat, "%s", p);
c0108316:	89 74 24 0c          	mov    %esi,0xc(%esp)
c010831a:	c7 44 24 08 02 aa 10 	movl   $0xc010aa02,0x8(%esp)
c0108321:	c0 
c0108322:	8b 45 0c             	mov    0xc(%ebp),%eax
c0108325:	89 44 24 04          	mov    %eax,0x4(%esp)
c0108329:	8b 45 08             	mov    0x8(%ebp),%eax
c010832c:	89 04 24             	mov    %eax,(%esp)
c010832f:	e8 3e fe ff ff       	call   c0108172 <printfmt>
            }
            break;
c0108334:	e9 45 02 00 00       	jmp    c010857e <vprintfmt+0x3de>

        // string
        case 's':
            if ((p = va_arg(ap, char *)) == NULL) {
c0108339:	8b 45 14             	mov    0x14(%ebp),%eax
c010833c:	8d 50 04             	lea    0x4(%eax),%edx
c010833f:	89 55 14             	mov    %edx,0x14(%ebp)
c0108342:	8b 30                	mov    (%eax),%esi
c0108344:	85 f6                	test   %esi,%esi
c0108346:	75 05                	jne    c010834d <vprintfmt+0x1ad>
                p = "(null)";
c0108348:	be 05 aa 10 c0       	mov    $0xc010aa05,%esi
            }
            if (width > 0 && padc != '-') {
c010834d:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
c0108351:	7e 3e                	jle    c0108391 <vprintfmt+0x1f1>
c0108353:	80 7d db 2d          	cmpb   $0x2d,-0x25(%ebp)
c0108357:	74 38                	je     c0108391 <vprintfmt+0x1f1>
                for (width -= strnlen(p, precision); width > 0; width --) {
c0108359:	8b 5d e8             	mov    -0x18(%ebp),%ebx
c010835c:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c010835f:	89 44 24 04          	mov    %eax,0x4(%esp)
c0108363:	89 34 24             	mov    %esi,(%esp)
c0108366:	e8 ed 03 00 00       	call   c0108758 <strnlen>
c010836b:	29 c3                	sub    %eax,%ebx
c010836d:	89 d8                	mov    %ebx,%eax
c010836f:	89 45 e8             	mov    %eax,-0x18(%ebp)
c0108372:	eb 17                	jmp    c010838b <vprintfmt+0x1eb>
                    putch(padc, putdat);
c0108374:	0f be 45 db          	movsbl -0x25(%ebp),%eax
c0108378:	8b 55 0c             	mov    0xc(%ebp),%edx
c010837b:	89 54 24 04          	mov    %edx,0x4(%esp)
c010837f:	89 04 24             	mov    %eax,(%esp)
c0108382:	8b 45 08             	mov    0x8(%ebp),%eax
c0108385:	ff d0                	call   *%eax
        case 's':
            if ((p = va_arg(ap, char *)) == NULL) {
                p = "(null)";
            }
            if (width > 0 && padc != '-') {
                for (width -= strnlen(p, precision); width > 0; width --) {
c0108387:	83 6d e8 01          	subl   $0x1,-0x18(%ebp)
c010838b:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
c010838f:	7f e3                	jg     c0108374 <vprintfmt+0x1d4>
                    putch(padc, putdat);
                }
            }
            for (; (ch = *p ++) != '\0' && (precision < 0 || -- precision >= 0); width --) {
c0108391:	eb 38                	jmp    c01083cb <vprintfmt+0x22b>
                if (altflag && (ch < ' ' || ch > '~')) {
c0108393:	83 7d dc 00          	cmpl   $0x0,-0x24(%ebp)
c0108397:	74 1f                	je     c01083b8 <vprintfmt+0x218>
c0108399:	83 fb 1f             	cmp    $0x1f,%ebx
c010839c:	7e 05                	jle    c01083a3 <vprintfmt+0x203>
c010839e:	83 fb 7e             	cmp    $0x7e,%ebx
c01083a1:	7e 15                	jle    c01083b8 <vprintfmt+0x218>
                    putch('?', putdat);
c01083a3:	8b 45 0c             	mov    0xc(%ebp),%eax
c01083a6:	89 44 24 04          	mov    %eax,0x4(%esp)
c01083aa:	c7 04 24 3f 00 00 00 	movl   $0x3f,(%esp)
c01083b1:	8b 45 08             	mov    0x8(%ebp),%eax
c01083b4:	ff d0                	call   *%eax
c01083b6:	eb 0f                	jmp    c01083c7 <vprintfmt+0x227>
                }
                else {
                    putch(ch, putdat);
c01083b8:	8b 45 0c             	mov    0xc(%ebp),%eax
c01083bb:	89 44 24 04          	mov    %eax,0x4(%esp)
c01083bf:	89 1c 24             	mov    %ebx,(%esp)
c01083c2:	8b 45 08             	mov    0x8(%ebp),%eax
c01083c5:	ff d0                	call   *%eax
            if (width > 0 && padc != '-') {
                for (width -= strnlen(p, precision); width > 0; width --) {
                    putch(padc, putdat);
                }
            }
            for (; (ch = *p ++) != '\0' && (precision < 0 || -- precision >= 0); width --) {
c01083c7:	83 6d e8 01          	subl   $0x1,-0x18(%ebp)
c01083cb:	89 f0                	mov    %esi,%eax
c01083cd:	8d 70 01             	lea    0x1(%eax),%esi
c01083d0:	0f b6 00             	movzbl (%eax),%eax
c01083d3:	0f be d8             	movsbl %al,%ebx
c01083d6:	85 db                	test   %ebx,%ebx
c01083d8:	74 10                	je     c01083ea <vprintfmt+0x24a>
c01083da:	83 7d e4 00          	cmpl   $0x0,-0x1c(%ebp)
c01083de:	78 b3                	js     c0108393 <vprintfmt+0x1f3>
c01083e0:	83 6d e4 01          	subl   $0x1,-0x1c(%ebp)
c01083e4:	83 7d e4 00          	cmpl   $0x0,-0x1c(%ebp)
c01083e8:	79 a9                	jns    c0108393 <vprintfmt+0x1f3>
                }
                else {
                    putch(ch, putdat);
                }
            }
            for (; width > 0; width --) {
c01083ea:	eb 17                	jmp    c0108403 <vprintfmt+0x263>
                putch(' ', putdat);
c01083ec:	8b 45 0c             	mov    0xc(%ebp),%eax
c01083ef:	89 44 24 04          	mov    %eax,0x4(%esp)
c01083f3:	c7 04 24 20 00 00 00 	movl   $0x20,(%esp)
c01083fa:	8b 45 08             	mov    0x8(%ebp),%eax
c01083fd:	ff d0                	call   *%eax
                }
                else {
                    putch(ch, putdat);
                }
            }
            for (; width > 0; width --) {
c01083ff:	83 6d e8 01          	subl   $0x1,-0x18(%ebp)
c0108403:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
c0108407:	7f e3                	jg     c01083ec <vprintfmt+0x24c>
                putch(' ', putdat);
            }
            break;
c0108409:	e9 70 01 00 00       	jmp    c010857e <vprintfmt+0x3de>

        // (signed) decimal
        case 'd':
            num = getint(&ap, lflag);
c010840e:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0108411:	89 44 24 04          	mov    %eax,0x4(%esp)
c0108415:	8d 45 14             	lea    0x14(%ebp),%eax
c0108418:	89 04 24             	mov    %eax,(%esp)
c010841b:	e8 0b fd ff ff       	call   c010812b <getint>
c0108420:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0108423:	89 55 f4             	mov    %edx,-0xc(%ebp)
            if ((long long)num < 0) {
c0108426:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0108429:	8b 55 f4             	mov    -0xc(%ebp),%edx
c010842c:	85 d2                	test   %edx,%edx
c010842e:	79 26                	jns    c0108456 <vprintfmt+0x2b6>
                putch('-', putdat);
c0108430:	8b 45 0c             	mov    0xc(%ebp),%eax
c0108433:	89 44 24 04          	mov    %eax,0x4(%esp)
c0108437:	c7 04 24 2d 00 00 00 	movl   $0x2d,(%esp)
c010843e:	8b 45 08             	mov    0x8(%ebp),%eax
c0108441:	ff d0                	call   *%eax
                num = -(long long)num;
c0108443:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0108446:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0108449:	f7 d8                	neg    %eax
c010844b:	83 d2 00             	adc    $0x0,%edx
c010844e:	f7 da                	neg    %edx
c0108450:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0108453:	89 55 f4             	mov    %edx,-0xc(%ebp)
            }
            base = 10;
c0108456:	c7 45 ec 0a 00 00 00 	movl   $0xa,-0x14(%ebp)
            goto number;
c010845d:	e9 a8 00 00 00       	jmp    c010850a <vprintfmt+0x36a>

        // unsigned decimal
        case 'u':
            num = getuint(&ap, lflag);
c0108462:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0108465:	89 44 24 04          	mov    %eax,0x4(%esp)
c0108469:	8d 45 14             	lea    0x14(%ebp),%eax
c010846c:	89 04 24             	mov    %eax,(%esp)
c010846f:	e8 68 fc ff ff       	call   c01080dc <getuint>
c0108474:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0108477:	89 55 f4             	mov    %edx,-0xc(%ebp)
            base = 10;
c010847a:	c7 45 ec 0a 00 00 00 	movl   $0xa,-0x14(%ebp)
            goto number;
c0108481:	e9 84 00 00 00       	jmp    c010850a <vprintfmt+0x36a>

        // (unsigned) octal
        case 'o':
            num = getuint(&ap, lflag);
c0108486:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0108489:	89 44 24 04          	mov    %eax,0x4(%esp)
c010848d:	8d 45 14             	lea    0x14(%ebp),%eax
c0108490:	89 04 24             	mov    %eax,(%esp)
c0108493:	e8 44 fc ff ff       	call   c01080dc <getuint>
c0108498:	89 45 f0             	mov    %eax,-0x10(%ebp)
c010849b:	89 55 f4             	mov    %edx,-0xc(%ebp)
            base = 8;
c010849e:	c7 45 ec 08 00 00 00 	movl   $0x8,-0x14(%ebp)
            goto number;
c01084a5:	eb 63                	jmp    c010850a <vprintfmt+0x36a>

        // pointer
        case 'p':
            putch('0', putdat);
c01084a7:	8b 45 0c             	mov    0xc(%ebp),%eax
c01084aa:	89 44 24 04          	mov    %eax,0x4(%esp)
c01084ae:	c7 04 24 30 00 00 00 	movl   $0x30,(%esp)
c01084b5:	8b 45 08             	mov    0x8(%ebp),%eax
c01084b8:	ff d0                	call   *%eax
            putch('x', putdat);
c01084ba:	8b 45 0c             	mov    0xc(%ebp),%eax
c01084bd:	89 44 24 04          	mov    %eax,0x4(%esp)
c01084c1:	c7 04 24 78 00 00 00 	movl   $0x78,(%esp)
c01084c8:	8b 45 08             	mov    0x8(%ebp),%eax
c01084cb:	ff d0                	call   *%eax
            num = (unsigned long long)(uintptr_t)va_arg(ap, void *);
c01084cd:	8b 45 14             	mov    0x14(%ebp),%eax
c01084d0:	8d 50 04             	lea    0x4(%eax),%edx
c01084d3:	89 55 14             	mov    %edx,0x14(%ebp)
c01084d6:	8b 00                	mov    (%eax),%eax
c01084d8:	89 45 f0             	mov    %eax,-0x10(%ebp)
c01084db:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
            base = 16;
c01084e2:	c7 45 ec 10 00 00 00 	movl   $0x10,-0x14(%ebp)
            goto number;
c01084e9:	eb 1f                	jmp    c010850a <vprintfmt+0x36a>

        // (unsigned) hexadecimal
        case 'x':
            num = getuint(&ap, lflag);
c01084eb:	8b 45 e0             	mov    -0x20(%ebp),%eax
c01084ee:	89 44 24 04          	mov    %eax,0x4(%esp)
c01084f2:	8d 45 14             	lea    0x14(%ebp),%eax
c01084f5:	89 04 24             	mov    %eax,(%esp)
c01084f8:	e8 df fb ff ff       	call   c01080dc <getuint>
c01084fd:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0108500:	89 55 f4             	mov    %edx,-0xc(%ebp)
            base = 16;
c0108503:	c7 45 ec 10 00 00 00 	movl   $0x10,-0x14(%ebp)
        number:
            printnum(putch, putdat, num, base, width, padc);
c010850a:	0f be 55 db          	movsbl -0x25(%ebp),%edx
c010850e:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0108511:	89 54 24 18          	mov    %edx,0x18(%esp)
c0108515:	8b 55 e8             	mov    -0x18(%ebp),%edx
c0108518:	89 54 24 14          	mov    %edx,0x14(%esp)
c010851c:	89 44 24 10          	mov    %eax,0x10(%esp)
c0108520:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0108523:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0108526:	89 44 24 08          	mov    %eax,0x8(%esp)
c010852a:	89 54 24 0c          	mov    %edx,0xc(%esp)
c010852e:	8b 45 0c             	mov    0xc(%ebp),%eax
c0108531:	89 44 24 04          	mov    %eax,0x4(%esp)
c0108535:	8b 45 08             	mov    0x8(%ebp),%eax
c0108538:	89 04 24             	mov    %eax,(%esp)
c010853b:	e8 97 fa ff ff       	call   c0107fd7 <printnum>
            break;
c0108540:	eb 3c                	jmp    c010857e <vprintfmt+0x3de>

        // escaped '%' character
        case '%':
            putch(ch, putdat);
c0108542:	8b 45 0c             	mov    0xc(%ebp),%eax
c0108545:	89 44 24 04          	mov    %eax,0x4(%esp)
c0108549:	89 1c 24             	mov    %ebx,(%esp)
c010854c:	8b 45 08             	mov    0x8(%ebp),%eax
c010854f:	ff d0                	call   *%eax
            break;
c0108551:	eb 2b                	jmp    c010857e <vprintfmt+0x3de>

        // unrecognized escape sequence - just print it literally
        default:
            putch('%', putdat);
c0108553:	8b 45 0c             	mov    0xc(%ebp),%eax
c0108556:	89 44 24 04          	mov    %eax,0x4(%esp)
c010855a:	c7 04 24 25 00 00 00 	movl   $0x25,(%esp)
c0108561:	8b 45 08             	mov    0x8(%ebp),%eax
c0108564:	ff d0                	call   *%eax
            for (fmt --; fmt[-1] != '%'; fmt --)
c0108566:	83 6d 10 01          	subl   $0x1,0x10(%ebp)
c010856a:	eb 04                	jmp    c0108570 <vprintfmt+0x3d0>
c010856c:	83 6d 10 01          	subl   $0x1,0x10(%ebp)
c0108570:	8b 45 10             	mov    0x10(%ebp),%eax
c0108573:	83 e8 01             	sub    $0x1,%eax
c0108576:	0f b6 00             	movzbl (%eax),%eax
c0108579:	3c 25                	cmp    $0x25,%al
c010857b:	75 ef                	jne    c010856c <vprintfmt+0x3cc>
                /* do nothing */;
            break;
c010857d:	90                   	nop
        }
    }
c010857e:	90                   	nop
    register int ch, err;
    unsigned long long num;
    int base, width, precision, lflag, altflag;

    while (1) {
        while ((ch = *(unsigned char *)fmt ++) != '%') {
c010857f:	e9 3e fc ff ff       	jmp    c01081c2 <vprintfmt+0x22>
            for (fmt --; fmt[-1] != '%'; fmt --)
                /* do nothing */;
            break;
        }
    }
}
c0108584:	83 c4 40             	add    $0x40,%esp
c0108587:	5b                   	pop    %ebx
c0108588:	5e                   	pop    %esi
c0108589:	5d                   	pop    %ebp
c010858a:	c3                   	ret    

c010858b <sprintputch>:
 * sprintputch - 'print' a single character in a buffer
 * @ch:         the character will be printed
 * @b:          the buffer to place the character @ch
 * */
static void
sprintputch(int ch, struct sprintbuf *b) {
c010858b:	55                   	push   %ebp
c010858c:	89 e5                	mov    %esp,%ebp
    b->cnt ++;
c010858e:	8b 45 0c             	mov    0xc(%ebp),%eax
c0108591:	8b 40 08             	mov    0x8(%eax),%eax
c0108594:	8d 50 01             	lea    0x1(%eax),%edx
c0108597:	8b 45 0c             	mov    0xc(%ebp),%eax
c010859a:	89 50 08             	mov    %edx,0x8(%eax)
    if (b->buf < b->ebuf) {
c010859d:	8b 45 0c             	mov    0xc(%ebp),%eax
c01085a0:	8b 10                	mov    (%eax),%edx
c01085a2:	8b 45 0c             	mov    0xc(%ebp),%eax
c01085a5:	8b 40 04             	mov    0x4(%eax),%eax
c01085a8:	39 c2                	cmp    %eax,%edx
c01085aa:	73 12                	jae    c01085be <sprintputch+0x33>
        *b->buf ++ = ch;
c01085ac:	8b 45 0c             	mov    0xc(%ebp),%eax
c01085af:	8b 00                	mov    (%eax),%eax
c01085b1:	8d 48 01             	lea    0x1(%eax),%ecx
c01085b4:	8b 55 0c             	mov    0xc(%ebp),%edx
c01085b7:	89 0a                	mov    %ecx,(%edx)
c01085b9:	8b 55 08             	mov    0x8(%ebp),%edx
c01085bc:	88 10                	mov    %dl,(%eax)
    }
}
c01085be:	5d                   	pop    %ebp
c01085bf:	c3                   	ret    

c01085c0 <snprintf>:
 * @str:        the buffer to place the result into
 * @size:       the size of buffer, including the trailing null space
 * @fmt:        the format string to use
 * */
int
snprintf(char *str, size_t size, const char *fmt, ...) {
c01085c0:	55                   	push   %ebp
c01085c1:	89 e5                	mov    %esp,%ebp
c01085c3:	83 ec 28             	sub    $0x28,%esp
    va_list ap;
    int cnt;
    va_start(ap, fmt);
c01085c6:	8d 45 14             	lea    0x14(%ebp),%eax
c01085c9:	89 45 f0             	mov    %eax,-0x10(%ebp)
    cnt = vsnprintf(str, size, fmt, ap);
c01085cc:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01085cf:	89 44 24 0c          	mov    %eax,0xc(%esp)
c01085d3:	8b 45 10             	mov    0x10(%ebp),%eax
c01085d6:	89 44 24 08          	mov    %eax,0x8(%esp)
c01085da:	8b 45 0c             	mov    0xc(%ebp),%eax
c01085dd:	89 44 24 04          	mov    %eax,0x4(%esp)
c01085e1:	8b 45 08             	mov    0x8(%ebp),%eax
c01085e4:	89 04 24             	mov    %eax,(%esp)
c01085e7:	e8 08 00 00 00       	call   c01085f4 <vsnprintf>
c01085ec:	89 45 f4             	mov    %eax,-0xc(%ebp)
    va_end(ap);
    return cnt;
c01085ef:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c01085f2:	c9                   	leave  
c01085f3:	c3                   	ret    

c01085f4 <vsnprintf>:
 *
 * Call this function if you are already dealing with a va_list.
 * Or you probably want snprintf() instead.
 * */
int
vsnprintf(char *str, size_t size, const char *fmt, va_list ap) {
c01085f4:	55                   	push   %ebp
c01085f5:	89 e5                	mov    %esp,%ebp
c01085f7:	83 ec 28             	sub    $0x28,%esp
    struct sprintbuf b = {str, str + size - 1, 0};
c01085fa:	8b 45 08             	mov    0x8(%ebp),%eax
c01085fd:	89 45 ec             	mov    %eax,-0x14(%ebp)
c0108600:	8b 45 0c             	mov    0xc(%ebp),%eax
c0108603:	8d 50 ff             	lea    -0x1(%eax),%edx
c0108606:	8b 45 08             	mov    0x8(%ebp),%eax
c0108609:	01 d0                	add    %edx,%eax
c010860b:	89 45 f0             	mov    %eax,-0x10(%ebp)
c010860e:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
    if (str == NULL || b.buf > b.ebuf) {
c0108615:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
c0108619:	74 0a                	je     c0108625 <vsnprintf+0x31>
c010861b:	8b 55 ec             	mov    -0x14(%ebp),%edx
c010861e:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0108621:	39 c2                	cmp    %eax,%edx
c0108623:	76 07                	jbe    c010862c <vsnprintf+0x38>
        return -E_INVAL;
c0108625:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
c010862a:	eb 2a                	jmp    c0108656 <vsnprintf+0x62>
    }
    // print the string to the buffer
    vprintfmt((void*)sprintputch, &b, fmt, ap);
c010862c:	8b 45 14             	mov    0x14(%ebp),%eax
c010862f:	89 44 24 0c          	mov    %eax,0xc(%esp)
c0108633:	8b 45 10             	mov    0x10(%ebp),%eax
c0108636:	89 44 24 08          	mov    %eax,0x8(%esp)
c010863a:	8d 45 ec             	lea    -0x14(%ebp),%eax
c010863d:	89 44 24 04          	mov    %eax,0x4(%esp)
c0108641:	c7 04 24 8b 85 10 c0 	movl   $0xc010858b,(%esp)
c0108648:	e8 53 fb ff ff       	call   c01081a0 <vprintfmt>
    // null terminate the buffer
    *b.buf = '\0';
c010864d:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0108650:	c6 00 00             	movb   $0x0,(%eax)
    return b.cnt;
c0108653:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c0108656:	c9                   	leave  
c0108657:	c3                   	ret    

c0108658 <rand>:
 * rand - returns a pseudo-random integer
 *
 * The rand() function return a value in the range [0, RAND_MAX].
 * */
int
rand(void) {
c0108658:	55                   	push   %ebp
c0108659:	89 e5                	mov    %esp,%ebp
c010865b:	57                   	push   %edi
c010865c:	56                   	push   %esi
c010865d:	53                   	push   %ebx
c010865e:	83 ec 24             	sub    $0x24,%esp
    next = (next * 0x5DEECE66DLL + 0xBLL) & ((1LL << 48) - 1);
c0108661:	a1 60 0a 12 c0       	mov    0xc0120a60,%eax
c0108666:	8b 15 64 0a 12 c0    	mov    0xc0120a64,%edx
c010866c:	69 fa 6d e6 ec de    	imul   $0xdeece66d,%edx,%edi
c0108672:	6b f0 05             	imul   $0x5,%eax,%esi
c0108675:	01 f7                	add    %esi,%edi
c0108677:	be 6d e6 ec de       	mov    $0xdeece66d,%esi
c010867c:	f7 e6                	mul    %esi
c010867e:	8d 34 17             	lea    (%edi,%edx,1),%esi
c0108681:	89 f2                	mov    %esi,%edx
c0108683:	83 c0 0b             	add    $0xb,%eax
c0108686:	83 d2 00             	adc    $0x0,%edx
c0108689:	89 c7                	mov    %eax,%edi
c010868b:	83 e7 ff             	and    $0xffffffff,%edi
c010868e:	89 f9                	mov    %edi,%ecx
c0108690:	0f b7 da             	movzwl %dx,%ebx
c0108693:	89 0d 60 0a 12 c0    	mov    %ecx,0xc0120a60
c0108699:	89 1d 64 0a 12 c0    	mov    %ebx,0xc0120a64
    unsigned long long result = (next >> 12);
c010869f:	a1 60 0a 12 c0       	mov    0xc0120a60,%eax
c01086a4:	8b 15 64 0a 12 c0    	mov    0xc0120a64,%edx
c01086aa:	0f ac d0 0c          	shrd   $0xc,%edx,%eax
c01086ae:	c1 ea 0c             	shr    $0xc,%edx
c01086b1:	89 45 e0             	mov    %eax,-0x20(%ebp)
c01086b4:	89 55 e4             	mov    %edx,-0x1c(%ebp)
    return (int)do_div(result, RAND_MAX + 1);
c01086b7:	c7 45 dc 00 00 00 80 	movl   $0x80000000,-0x24(%ebp)
c01086be:	8b 45 e0             	mov    -0x20(%ebp),%eax
c01086c1:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c01086c4:	89 45 d8             	mov    %eax,-0x28(%ebp)
c01086c7:	89 55 e8             	mov    %edx,-0x18(%ebp)
c01086ca:	8b 45 e8             	mov    -0x18(%ebp),%eax
c01086cd:	89 45 ec             	mov    %eax,-0x14(%ebp)
c01086d0:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
c01086d4:	74 1c                	je     c01086f2 <rand+0x9a>
c01086d6:	8b 45 e8             	mov    -0x18(%ebp),%eax
c01086d9:	ba 00 00 00 00       	mov    $0x0,%edx
c01086de:	f7 75 dc             	divl   -0x24(%ebp)
c01086e1:	89 55 ec             	mov    %edx,-0x14(%ebp)
c01086e4:	8b 45 e8             	mov    -0x18(%ebp),%eax
c01086e7:	ba 00 00 00 00       	mov    $0x0,%edx
c01086ec:	f7 75 dc             	divl   -0x24(%ebp)
c01086ef:	89 45 e8             	mov    %eax,-0x18(%ebp)
c01086f2:	8b 45 d8             	mov    -0x28(%ebp),%eax
c01086f5:	8b 55 ec             	mov    -0x14(%ebp),%edx
c01086f8:	f7 75 dc             	divl   -0x24(%ebp)
c01086fb:	89 45 d8             	mov    %eax,-0x28(%ebp)
c01086fe:	89 55 d4             	mov    %edx,-0x2c(%ebp)
c0108701:	8b 45 d8             	mov    -0x28(%ebp),%eax
c0108704:	8b 55 e8             	mov    -0x18(%ebp),%edx
c0108707:	89 45 e0             	mov    %eax,-0x20(%ebp)
c010870a:	89 55 e4             	mov    %edx,-0x1c(%ebp)
c010870d:	8b 45 d4             	mov    -0x2c(%ebp),%eax
}
c0108710:	83 c4 24             	add    $0x24,%esp
c0108713:	5b                   	pop    %ebx
c0108714:	5e                   	pop    %esi
c0108715:	5f                   	pop    %edi
c0108716:	5d                   	pop    %ebp
c0108717:	c3                   	ret    

c0108718 <srand>:
/* *
 * srand - seed the random number generator with the given number
 * @seed:   the required seed number
 * */
void
srand(unsigned int seed) {
c0108718:	55                   	push   %ebp
c0108719:	89 e5                	mov    %esp,%ebp
    next = seed;
c010871b:	8b 45 08             	mov    0x8(%ebp),%eax
c010871e:	ba 00 00 00 00       	mov    $0x0,%edx
c0108723:	a3 60 0a 12 c0       	mov    %eax,0xc0120a60
c0108728:	89 15 64 0a 12 c0    	mov    %edx,0xc0120a64
}
c010872e:	5d                   	pop    %ebp
c010872f:	c3                   	ret    

c0108730 <strlen>:
 * @s:      the input string
 *
 * The strlen() function returns the length of string @s.
 * */
size_t
strlen(const char *s) {
c0108730:	55                   	push   %ebp
c0108731:	89 e5                	mov    %esp,%ebp
c0108733:	83 ec 10             	sub    $0x10,%esp
    size_t cnt = 0;
c0108736:	c7 45 fc 00 00 00 00 	movl   $0x0,-0x4(%ebp)
    while (*s ++ != '\0') {
c010873d:	eb 04                	jmp    c0108743 <strlen+0x13>
        cnt ++;
c010873f:	83 45 fc 01          	addl   $0x1,-0x4(%ebp)
 * The strlen() function returns the length of string @s.
 * */
size_t
strlen(const char *s) {
    size_t cnt = 0;
    while (*s ++ != '\0') {
c0108743:	8b 45 08             	mov    0x8(%ebp),%eax
c0108746:	8d 50 01             	lea    0x1(%eax),%edx
c0108749:	89 55 08             	mov    %edx,0x8(%ebp)
c010874c:	0f b6 00             	movzbl (%eax),%eax
c010874f:	84 c0                	test   %al,%al
c0108751:	75 ec                	jne    c010873f <strlen+0xf>
        cnt ++;
    }
    return cnt;
c0108753:	8b 45 fc             	mov    -0x4(%ebp),%eax
}
c0108756:	c9                   	leave  
c0108757:	c3                   	ret    

c0108758 <strnlen>:
 * The return value is strlen(s), if that is less than @len, or
 * @len if there is no '\0' character among the first @len characters
 * pointed by @s.
 * */
size_t
strnlen(const char *s, size_t len) {
c0108758:	55                   	push   %ebp
c0108759:	89 e5                	mov    %esp,%ebp
c010875b:	83 ec 10             	sub    $0x10,%esp
    size_t cnt = 0;
c010875e:	c7 45 fc 00 00 00 00 	movl   $0x0,-0x4(%ebp)
    while (cnt < len && *s ++ != '\0') {
c0108765:	eb 04                	jmp    c010876b <strnlen+0x13>
        cnt ++;
c0108767:	83 45 fc 01          	addl   $0x1,-0x4(%ebp)
 * pointed by @s.
 * */
size_t
strnlen(const char *s, size_t len) {
    size_t cnt = 0;
    while (cnt < len && *s ++ != '\0') {
c010876b:	8b 45 fc             	mov    -0x4(%ebp),%eax
c010876e:	3b 45 0c             	cmp    0xc(%ebp),%eax
c0108771:	73 10                	jae    c0108783 <strnlen+0x2b>
c0108773:	8b 45 08             	mov    0x8(%ebp),%eax
c0108776:	8d 50 01             	lea    0x1(%eax),%edx
c0108779:	89 55 08             	mov    %edx,0x8(%ebp)
c010877c:	0f b6 00             	movzbl (%eax),%eax
c010877f:	84 c0                	test   %al,%al
c0108781:	75 e4                	jne    c0108767 <strnlen+0xf>
        cnt ++;
    }
    return cnt;
c0108783:	8b 45 fc             	mov    -0x4(%ebp),%eax
}
c0108786:	c9                   	leave  
c0108787:	c3                   	ret    

c0108788 <strcpy>:
 * To avoid overflows, the size of array pointed by @dst should be long enough to
 * contain the same string as @src (including the terminating null character), and
 * should not overlap in memory with @src.
 * */
char *
strcpy(char *dst, const char *src) {
c0108788:	55                   	push   %ebp
c0108789:	89 e5                	mov    %esp,%ebp
c010878b:	57                   	push   %edi
c010878c:	56                   	push   %esi
c010878d:	83 ec 20             	sub    $0x20,%esp
c0108790:	8b 45 08             	mov    0x8(%ebp),%eax
c0108793:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0108796:	8b 45 0c             	mov    0xc(%ebp),%eax
c0108799:	89 45 f0             	mov    %eax,-0x10(%ebp)
#ifndef __HAVE_ARCH_STRCPY
#define __HAVE_ARCH_STRCPY
static inline char *
__strcpy(char *dst, const char *src) {
    int d0, d1, d2;
    asm volatile (
c010879c:	8b 55 f0             	mov    -0x10(%ebp),%edx
c010879f:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01087a2:	89 d1                	mov    %edx,%ecx
c01087a4:	89 c2                	mov    %eax,%edx
c01087a6:	89 ce                	mov    %ecx,%esi
c01087a8:	89 d7                	mov    %edx,%edi
c01087aa:	ac                   	lods   %ds:(%esi),%al
c01087ab:	aa                   	stos   %al,%es:(%edi)
c01087ac:	84 c0                	test   %al,%al
c01087ae:	75 fa                	jne    c01087aa <strcpy+0x22>
c01087b0:	89 fa                	mov    %edi,%edx
c01087b2:	89 f1                	mov    %esi,%ecx
c01087b4:	89 4d ec             	mov    %ecx,-0x14(%ebp)
c01087b7:	89 55 e8             	mov    %edx,-0x18(%ebp)
c01087ba:	89 45 e4             	mov    %eax,-0x1c(%ebp)
        "stosb;"
        "testb %%al, %%al;"
        "jne 1b;"
        : "=&S" (d0), "=&D" (d1), "=&a" (d2)
        : "0" (src), "1" (dst) : "memory");
    return dst;
c01087bd:	8b 45 f4             	mov    -0xc(%ebp),%eax
    char *p = dst;
    while ((*p ++ = *src ++) != '\0')
        /* nothing */;
    return dst;
#endif /* __HAVE_ARCH_STRCPY */
}
c01087c0:	83 c4 20             	add    $0x20,%esp
c01087c3:	5e                   	pop    %esi
c01087c4:	5f                   	pop    %edi
c01087c5:	5d                   	pop    %ebp
c01087c6:	c3                   	ret    

c01087c7 <strncpy>:
 * @len:    maximum number of characters to be copied from @src
 *
 * The return value is @dst
 * */
char *
strncpy(char *dst, const char *src, size_t len) {
c01087c7:	55                   	push   %ebp
c01087c8:	89 e5                	mov    %esp,%ebp
c01087ca:	83 ec 10             	sub    $0x10,%esp
    char *p = dst;
c01087cd:	8b 45 08             	mov    0x8(%ebp),%eax
c01087d0:	89 45 fc             	mov    %eax,-0x4(%ebp)
    while (len > 0) {
c01087d3:	eb 21                	jmp    c01087f6 <strncpy+0x2f>
        if ((*p = *src) != '\0') {
c01087d5:	8b 45 0c             	mov    0xc(%ebp),%eax
c01087d8:	0f b6 10             	movzbl (%eax),%edx
c01087db:	8b 45 fc             	mov    -0x4(%ebp),%eax
c01087de:	88 10                	mov    %dl,(%eax)
c01087e0:	8b 45 fc             	mov    -0x4(%ebp),%eax
c01087e3:	0f b6 00             	movzbl (%eax),%eax
c01087e6:	84 c0                	test   %al,%al
c01087e8:	74 04                	je     c01087ee <strncpy+0x27>
            src ++;
c01087ea:	83 45 0c 01          	addl   $0x1,0xc(%ebp)
        }
        p ++, len --;
c01087ee:	83 45 fc 01          	addl   $0x1,-0x4(%ebp)
c01087f2:	83 6d 10 01          	subl   $0x1,0x10(%ebp)
 * The return value is @dst
 * */
char *
strncpy(char *dst, const char *src, size_t len) {
    char *p = dst;
    while (len > 0) {
c01087f6:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
c01087fa:	75 d9                	jne    c01087d5 <strncpy+0xe>
        if ((*p = *src) != '\0') {
            src ++;
        }
        p ++, len --;
    }
    return dst;
c01087fc:	8b 45 08             	mov    0x8(%ebp),%eax
}
c01087ff:	c9                   	leave  
c0108800:	c3                   	ret    

c0108801 <strcmp>:
 * - A value greater than zero indicates that the first character that does
 *   not match has a greater value in @s1 than in @s2;
 * - And a value less than zero indicates the opposite.
 * */
int
strcmp(const char *s1, const char *s2) {
c0108801:	55                   	push   %ebp
c0108802:	89 e5                	mov    %esp,%ebp
c0108804:	57                   	push   %edi
c0108805:	56                   	push   %esi
c0108806:	83 ec 20             	sub    $0x20,%esp
c0108809:	8b 45 08             	mov    0x8(%ebp),%eax
c010880c:	89 45 f4             	mov    %eax,-0xc(%ebp)
c010880f:	8b 45 0c             	mov    0xc(%ebp),%eax
c0108812:	89 45 f0             	mov    %eax,-0x10(%ebp)
#ifndef __HAVE_ARCH_STRCMP
#define __HAVE_ARCH_STRCMP
static inline int
__strcmp(const char *s1, const char *s2) {
    int d0, d1, ret;
    asm volatile (
c0108815:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0108818:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010881b:	89 d1                	mov    %edx,%ecx
c010881d:	89 c2                	mov    %eax,%edx
c010881f:	89 ce                	mov    %ecx,%esi
c0108821:	89 d7                	mov    %edx,%edi
c0108823:	ac                   	lods   %ds:(%esi),%al
c0108824:	ae                   	scas   %es:(%edi),%al
c0108825:	75 08                	jne    c010882f <strcmp+0x2e>
c0108827:	84 c0                	test   %al,%al
c0108829:	75 f8                	jne    c0108823 <strcmp+0x22>
c010882b:	31 c0                	xor    %eax,%eax
c010882d:	eb 04                	jmp    c0108833 <strcmp+0x32>
c010882f:	19 c0                	sbb    %eax,%eax
c0108831:	0c 01                	or     $0x1,%al
c0108833:	89 fa                	mov    %edi,%edx
c0108835:	89 f1                	mov    %esi,%ecx
c0108837:	89 45 ec             	mov    %eax,-0x14(%ebp)
c010883a:	89 4d e8             	mov    %ecx,-0x18(%ebp)
c010883d:	89 55 e4             	mov    %edx,-0x1c(%ebp)
        "orb $1, %%al;"
        "3:"
        : "=a" (ret), "=&S" (d0), "=&D" (d1)
        : "1" (s1), "2" (s2)
        : "memory");
    return ret;
c0108840:	8b 45 ec             	mov    -0x14(%ebp),%eax
    while (*s1 != '\0' && *s1 == *s2) {
        s1 ++, s2 ++;
    }
    return (int)((unsigned char)*s1 - (unsigned char)*s2);
#endif /* __HAVE_ARCH_STRCMP */
}
c0108843:	83 c4 20             	add    $0x20,%esp
c0108846:	5e                   	pop    %esi
c0108847:	5f                   	pop    %edi
c0108848:	5d                   	pop    %ebp
c0108849:	c3                   	ret    

c010884a <strncmp>:
 * they are equal to each other, it continues with the following pairs until
 * the characters differ, until a terminating null-character is reached, or
 * until @n characters match in both strings, whichever happens first.
 * */
int
strncmp(const char *s1, const char *s2, size_t n) {
c010884a:	55                   	push   %ebp
c010884b:	89 e5                	mov    %esp,%ebp
    while (n > 0 && *s1 != '\0' && *s1 == *s2) {
c010884d:	eb 0c                	jmp    c010885b <strncmp+0x11>
        n --, s1 ++, s2 ++;
c010884f:	83 6d 10 01          	subl   $0x1,0x10(%ebp)
c0108853:	83 45 08 01          	addl   $0x1,0x8(%ebp)
c0108857:	83 45 0c 01          	addl   $0x1,0xc(%ebp)
 * the characters differ, until a terminating null-character is reached, or
 * until @n characters match in both strings, whichever happens first.
 * */
int
strncmp(const char *s1, const char *s2, size_t n) {
    while (n > 0 && *s1 != '\0' && *s1 == *s2) {
c010885b:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
c010885f:	74 1a                	je     c010887b <strncmp+0x31>
c0108861:	8b 45 08             	mov    0x8(%ebp),%eax
c0108864:	0f b6 00             	movzbl (%eax),%eax
c0108867:	84 c0                	test   %al,%al
c0108869:	74 10                	je     c010887b <strncmp+0x31>
c010886b:	8b 45 08             	mov    0x8(%ebp),%eax
c010886e:	0f b6 10             	movzbl (%eax),%edx
c0108871:	8b 45 0c             	mov    0xc(%ebp),%eax
c0108874:	0f b6 00             	movzbl (%eax),%eax
c0108877:	38 c2                	cmp    %al,%dl
c0108879:	74 d4                	je     c010884f <strncmp+0x5>
        n --, s1 ++, s2 ++;
    }
    return (n == 0) ? 0 : (int)((unsigned char)*s1 - (unsigned char)*s2);
c010887b:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
c010887f:	74 18                	je     c0108899 <strncmp+0x4f>
c0108881:	8b 45 08             	mov    0x8(%ebp),%eax
c0108884:	0f b6 00             	movzbl (%eax),%eax
c0108887:	0f b6 d0             	movzbl %al,%edx
c010888a:	8b 45 0c             	mov    0xc(%ebp),%eax
c010888d:	0f b6 00             	movzbl (%eax),%eax
c0108890:	0f b6 c0             	movzbl %al,%eax
c0108893:	29 c2                	sub    %eax,%edx
c0108895:	89 d0                	mov    %edx,%eax
c0108897:	eb 05                	jmp    c010889e <strncmp+0x54>
c0108899:	b8 00 00 00 00       	mov    $0x0,%eax
}
c010889e:	5d                   	pop    %ebp
c010889f:	c3                   	ret    

c01088a0 <strchr>:
 *
 * The strchr() function returns a pointer to the first occurrence of
 * character in @s. If the value is not found, the function returns 'NULL'.
 * */
char *
strchr(const char *s, char c) {
c01088a0:	55                   	push   %ebp
c01088a1:	89 e5                	mov    %esp,%ebp
c01088a3:	83 ec 04             	sub    $0x4,%esp
c01088a6:	8b 45 0c             	mov    0xc(%ebp),%eax
c01088a9:	88 45 fc             	mov    %al,-0x4(%ebp)
    while (*s != '\0') {
c01088ac:	eb 14                	jmp    c01088c2 <strchr+0x22>
        if (*s == c) {
c01088ae:	8b 45 08             	mov    0x8(%ebp),%eax
c01088b1:	0f b6 00             	movzbl (%eax),%eax
c01088b4:	3a 45 fc             	cmp    -0x4(%ebp),%al
c01088b7:	75 05                	jne    c01088be <strchr+0x1e>
            return (char *)s;
c01088b9:	8b 45 08             	mov    0x8(%ebp),%eax
c01088bc:	eb 13                	jmp    c01088d1 <strchr+0x31>
        }
        s ++;
c01088be:	83 45 08 01          	addl   $0x1,0x8(%ebp)
 * The strchr() function returns a pointer to the first occurrence of
 * character in @s. If the value is not found, the function returns 'NULL'.
 * */
char *
strchr(const char *s, char c) {
    while (*s != '\0') {
c01088c2:	8b 45 08             	mov    0x8(%ebp),%eax
c01088c5:	0f b6 00             	movzbl (%eax),%eax
c01088c8:	84 c0                	test   %al,%al
c01088ca:	75 e2                	jne    c01088ae <strchr+0xe>
        if (*s == c) {
            return (char *)s;
        }
        s ++;
    }
    return NULL;
c01088cc:	b8 00 00 00 00       	mov    $0x0,%eax
}
c01088d1:	c9                   	leave  
c01088d2:	c3                   	ret    

c01088d3 <strfind>:
 * The strfind() function is like strchr() except that if @c is
 * not found in @s, then it returns a pointer to the null byte at the
 * end of @s, rather than 'NULL'.
 * */
char *
strfind(const char *s, char c) {
c01088d3:	55                   	push   %ebp
c01088d4:	89 e5                	mov    %esp,%ebp
c01088d6:	83 ec 04             	sub    $0x4,%esp
c01088d9:	8b 45 0c             	mov    0xc(%ebp),%eax
c01088dc:	88 45 fc             	mov    %al,-0x4(%ebp)
    while (*s != '\0') {
c01088df:	eb 11                	jmp    c01088f2 <strfind+0x1f>
        if (*s == c) {
c01088e1:	8b 45 08             	mov    0x8(%ebp),%eax
c01088e4:	0f b6 00             	movzbl (%eax),%eax
c01088e7:	3a 45 fc             	cmp    -0x4(%ebp),%al
c01088ea:	75 02                	jne    c01088ee <strfind+0x1b>
            break;
c01088ec:	eb 0e                	jmp    c01088fc <strfind+0x29>
        }
        s ++;
c01088ee:	83 45 08 01          	addl   $0x1,0x8(%ebp)
 * not found in @s, then it returns a pointer to the null byte at the
 * end of @s, rather than 'NULL'.
 * */
char *
strfind(const char *s, char c) {
    while (*s != '\0') {
c01088f2:	8b 45 08             	mov    0x8(%ebp),%eax
c01088f5:	0f b6 00             	movzbl (%eax),%eax
c01088f8:	84 c0                	test   %al,%al
c01088fa:	75 e5                	jne    c01088e1 <strfind+0xe>
        if (*s == c) {
            break;
        }
        s ++;
    }
    return (char *)s;
c01088fc:	8b 45 08             	mov    0x8(%ebp),%eax
}
c01088ff:	c9                   	leave  
c0108900:	c3                   	ret    

c0108901 <strtol>:
 * an optional "0x" or "0X" prefix.
 *
 * The strtol() function returns the converted integral number as a long int value.
 * */
long
strtol(const char *s, char **endptr, int base) {
c0108901:	55                   	push   %ebp
c0108902:	89 e5                	mov    %esp,%ebp
c0108904:	83 ec 10             	sub    $0x10,%esp
    int neg = 0;
c0108907:	c7 45 fc 00 00 00 00 	movl   $0x0,-0x4(%ebp)
    long val = 0;
c010890e:	c7 45 f8 00 00 00 00 	movl   $0x0,-0x8(%ebp)

    // gobble initial whitespace
    while (*s == ' ' || *s == '\t') {
c0108915:	eb 04                	jmp    c010891b <strtol+0x1a>
        s ++;
c0108917:	83 45 08 01          	addl   $0x1,0x8(%ebp)
strtol(const char *s, char **endptr, int base) {
    int neg = 0;
    long val = 0;

    // gobble initial whitespace
    while (*s == ' ' || *s == '\t') {
c010891b:	8b 45 08             	mov    0x8(%ebp),%eax
c010891e:	0f b6 00             	movzbl (%eax),%eax
c0108921:	3c 20                	cmp    $0x20,%al
c0108923:	74 f2                	je     c0108917 <strtol+0x16>
c0108925:	8b 45 08             	mov    0x8(%ebp),%eax
c0108928:	0f b6 00             	movzbl (%eax),%eax
c010892b:	3c 09                	cmp    $0x9,%al
c010892d:	74 e8                	je     c0108917 <strtol+0x16>
        s ++;
    }

    // plus/minus sign
    if (*s == '+') {
c010892f:	8b 45 08             	mov    0x8(%ebp),%eax
c0108932:	0f b6 00             	movzbl (%eax),%eax
c0108935:	3c 2b                	cmp    $0x2b,%al
c0108937:	75 06                	jne    c010893f <strtol+0x3e>
        s ++;
c0108939:	83 45 08 01          	addl   $0x1,0x8(%ebp)
c010893d:	eb 15                	jmp    c0108954 <strtol+0x53>
    }
    else if (*s == '-') {
c010893f:	8b 45 08             	mov    0x8(%ebp),%eax
c0108942:	0f b6 00             	movzbl (%eax),%eax
c0108945:	3c 2d                	cmp    $0x2d,%al
c0108947:	75 0b                	jne    c0108954 <strtol+0x53>
        s ++, neg = 1;
c0108949:	83 45 08 01          	addl   $0x1,0x8(%ebp)
c010894d:	c7 45 fc 01 00 00 00 	movl   $0x1,-0x4(%ebp)
    }

    // hex or octal base prefix
    if ((base == 0 || base == 16) && (s[0] == '0' && s[1] == 'x')) {
c0108954:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
c0108958:	74 06                	je     c0108960 <strtol+0x5f>
c010895a:	83 7d 10 10          	cmpl   $0x10,0x10(%ebp)
c010895e:	75 24                	jne    c0108984 <strtol+0x83>
c0108960:	8b 45 08             	mov    0x8(%ebp),%eax
c0108963:	0f b6 00             	movzbl (%eax),%eax
c0108966:	3c 30                	cmp    $0x30,%al
c0108968:	75 1a                	jne    c0108984 <strtol+0x83>
c010896a:	8b 45 08             	mov    0x8(%ebp),%eax
c010896d:	83 c0 01             	add    $0x1,%eax
c0108970:	0f b6 00             	movzbl (%eax),%eax
c0108973:	3c 78                	cmp    $0x78,%al
c0108975:	75 0d                	jne    c0108984 <strtol+0x83>
        s += 2, base = 16;
c0108977:	83 45 08 02          	addl   $0x2,0x8(%ebp)
c010897b:	c7 45 10 10 00 00 00 	movl   $0x10,0x10(%ebp)
c0108982:	eb 2a                	jmp    c01089ae <strtol+0xad>
    }
    else if (base == 0 && s[0] == '0') {
c0108984:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
c0108988:	75 17                	jne    c01089a1 <strtol+0xa0>
c010898a:	8b 45 08             	mov    0x8(%ebp),%eax
c010898d:	0f b6 00             	movzbl (%eax),%eax
c0108990:	3c 30                	cmp    $0x30,%al
c0108992:	75 0d                	jne    c01089a1 <strtol+0xa0>
        s ++, base = 8;
c0108994:	83 45 08 01          	addl   $0x1,0x8(%ebp)
c0108998:	c7 45 10 08 00 00 00 	movl   $0x8,0x10(%ebp)
c010899f:	eb 0d                	jmp    c01089ae <strtol+0xad>
    }
    else if (base == 0) {
c01089a1:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
c01089a5:	75 07                	jne    c01089ae <strtol+0xad>
        base = 10;
c01089a7:	c7 45 10 0a 00 00 00 	movl   $0xa,0x10(%ebp)

    // digits
    while (1) {
        int dig;

        if (*s >= '0' && *s <= '9') {
c01089ae:	8b 45 08             	mov    0x8(%ebp),%eax
c01089b1:	0f b6 00             	movzbl (%eax),%eax
c01089b4:	3c 2f                	cmp    $0x2f,%al
c01089b6:	7e 1b                	jle    c01089d3 <strtol+0xd2>
c01089b8:	8b 45 08             	mov    0x8(%ebp),%eax
c01089bb:	0f b6 00             	movzbl (%eax),%eax
c01089be:	3c 39                	cmp    $0x39,%al
c01089c0:	7f 11                	jg     c01089d3 <strtol+0xd2>
            dig = *s - '0';
c01089c2:	8b 45 08             	mov    0x8(%ebp),%eax
c01089c5:	0f b6 00             	movzbl (%eax),%eax
c01089c8:	0f be c0             	movsbl %al,%eax
c01089cb:	83 e8 30             	sub    $0x30,%eax
c01089ce:	89 45 f4             	mov    %eax,-0xc(%ebp)
c01089d1:	eb 48                	jmp    c0108a1b <strtol+0x11a>
        }
        else if (*s >= 'a' && *s <= 'z') {
c01089d3:	8b 45 08             	mov    0x8(%ebp),%eax
c01089d6:	0f b6 00             	movzbl (%eax),%eax
c01089d9:	3c 60                	cmp    $0x60,%al
c01089db:	7e 1b                	jle    c01089f8 <strtol+0xf7>
c01089dd:	8b 45 08             	mov    0x8(%ebp),%eax
c01089e0:	0f b6 00             	movzbl (%eax),%eax
c01089e3:	3c 7a                	cmp    $0x7a,%al
c01089e5:	7f 11                	jg     c01089f8 <strtol+0xf7>
            dig = *s - 'a' + 10;
c01089e7:	8b 45 08             	mov    0x8(%ebp),%eax
c01089ea:	0f b6 00             	movzbl (%eax),%eax
c01089ed:	0f be c0             	movsbl %al,%eax
c01089f0:	83 e8 57             	sub    $0x57,%eax
c01089f3:	89 45 f4             	mov    %eax,-0xc(%ebp)
c01089f6:	eb 23                	jmp    c0108a1b <strtol+0x11a>
        }
        else if (*s >= 'A' && *s <= 'Z') {
c01089f8:	8b 45 08             	mov    0x8(%ebp),%eax
c01089fb:	0f b6 00             	movzbl (%eax),%eax
c01089fe:	3c 40                	cmp    $0x40,%al
c0108a00:	7e 3d                	jle    c0108a3f <strtol+0x13e>
c0108a02:	8b 45 08             	mov    0x8(%ebp),%eax
c0108a05:	0f b6 00             	movzbl (%eax),%eax
c0108a08:	3c 5a                	cmp    $0x5a,%al
c0108a0a:	7f 33                	jg     c0108a3f <strtol+0x13e>
            dig = *s - 'A' + 10;
c0108a0c:	8b 45 08             	mov    0x8(%ebp),%eax
c0108a0f:	0f b6 00             	movzbl (%eax),%eax
c0108a12:	0f be c0             	movsbl %al,%eax
c0108a15:	83 e8 37             	sub    $0x37,%eax
c0108a18:	89 45 f4             	mov    %eax,-0xc(%ebp)
        }
        else {
            break;
        }
        if (dig >= base) {
c0108a1b:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0108a1e:	3b 45 10             	cmp    0x10(%ebp),%eax
c0108a21:	7c 02                	jl     c0108a25 <strtol+0x124>
            break;
c0108a23:	eb 1a                	jmp    c0108a3f <strtol+0x13e>
        }
        s ++, val = (val * base) + dig;
c0108a25:	83 45 08 01          	addl   $0x1,0x8(%ebp)
c0108a29:	8b 45 f8             	mov    -0x8(%ebp),%eax
c0108a2c:	0f af 45 10          	imul   0x10(%ebp),%eax
c0108a30:	89 c2                	mov    %eax,%edx
c0108a32:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0108a35:	01 d0                	add    %edx,%eax
c0108a37:	89 45 f8             	mov    %eax,-0x8(%ebp)
        // we don't properly detect overflow!
    }
c0108a3a:	e9 6f ff ff ff       	jmp    c01089ae <strtol+0xad>

    if (endptr) {
c0108a3f:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
c0108a43:	74 08                	je     c0108a4d <strtol+0x14c>
        *endptr = (char *) s;
c0108a45:	8b 45 0c             	mov    0xc(%ebp),%eax
c0108a48:	8b 55 08             	mov    0x8(%ebp),%edx
c0108a4b:	89 10                	mov    %edx,(%eax)
    }
    return (neg ? -val : val);
c0108a4d:	83 7d fc 00          	cmpl   $0x0,-0x4(%ebp)
c0108a51:	74 07                	je     c0108a5a <strtol+0x159>
c0108a53:	8b 45 f8             	mov    -0x8(%ebp),%eax
c0108a56:	f7 d8                	neg    %eax
c0108a58:	eb 03                	jmp    c0108a5d <strtol+0x15c>
c0108a5a:	8b 45 f8             	mov    -0x8(%ebp),%eax
}
c0108a5d:	c9                   	leave  
c0108a5e:	c3                   	ret    

c0108a5f <memset>:
 * @n:      number of bytes to be set to the value
 *
 * The memset() function returns @s.
 * */
void *
memset(void *s, char c, size_t n) {
c0108a5f:	55                   	push   %ebp
c0108a60:	89 e5                	mov    %esp,%ebp
c0108a62:	57                   	push   %edi
c0108a63:	83 ec 24             	sub    $0x24,%esp
c0108a66:	8b 45 0c             	mov    0xc(%ebp),%eax
c0108a69:	88 45 d8             	mov    %al,-0x28(%ebp)
#ifdef __HAVE_ARCH_MEMSET
    return __memset(s, c, n);
c0108a6c:	0f be 45 d8          	movsbl -0x28(%ebp),%eax
c0108a70:	8b 55 08             	mov    0x8(%ebp),%edx
c0108a73:	89 55 f8             	mov    %edx,-0x8(%ebp)
c0108a76:	88 45 f7             	mov    %al,-0x9(%ebp)
c0108a79:	8b 45 10             	mov    0x10(%ebp),%eax
c0108a7c:	89 45 f0             	mov    %eax,-0x10(%ebp)
#ifndef __HAVE_ARCH_MEMSET
#define __HAVE_ARCH_MEMSET
static inline void *
__memset(void *s, char c, size_t n) {
    int d0, d1;
    asm volatile (
c0108a7f:	8b 4d f0             	mov    -0x10(%ebp),%ecx
c0108a82:	0f b6 45 f7          	movzbl -0x9(%ebp),%eax
c0108a86:	8b 55 f8             	mov    -0x8(%ebp),%edx
c0108a89:	89 d7                	mov    %edx,%edi
c0108a8b:	f3 aa                	rep stos %al,%es:(%edi)
c0108a8d:	89 fa                	mov    %edi,%edx
c0108a8f:	89 4d ec             	mov    %ecx,-0x14(%ebp)
c0108a92:	89 55 e8             	mov    %edx,-0x18(%ebp)
        "rep; stosb;"
        : "=&c" (d0), "=&D" (d1)
        : "0" (n), "a" (c), "1" (s)
        : "memory");
    return s;
c0108a95:	8b 45 f8             	mov    -0x8(%ebp),%eax
    while (n -- > 0) {
        *p ++ = c;
    }
    return s;
#endif /* __HAVE_ARCH_MEMSET */
}
c0108a98:	83 c4 24             	add    $0x24,%esp
c0108a9b:	5f                   	pop    %edi
c0108a9c:	5d                   	pop    %ebp
c0108a9d:	c3                   	ret    

c0108a9e <memmove>:
 * @n:      number of bytes to copy
 *
 * The memmove() function returns @dst.
 * */
void *
memmove(void *dst, const void *src, size_t n) {
c0108a9e:	55                   	push   %ebp
c0108a9f:	89 e5                	mov    %esp,%ebp
c0108aa1:	57                   	push   %edi
c0108aa2:	56                   	push   %esi
c0108aa3:	53                   	push   %ebx
c0108aa4:	83 ec 30             	sub    $0x30,%esp
c0108aa7:	8b 45 08             	mov    0x8(%ebp),%eax
c0108aaa:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0108aad:	8b 45 0c             	mov    0xc(%ebp),%eax
c0108ab0:	89 45 ec             	mov    %eax,-0x14(%ebp)
c0108ab3:	8b 45 10             	mov    0x10(%ebp),%eax
c0108ab6:	89 45 e8             	mov    %eax,-0x18(%ebp)

#ifndef __HAVE_ARCH_MEMMOVE
#define __HAVE_ARCH_MEMMOVE
static inline void *
__memmove(void *dst, const void *src, size_t n) {
    if (dst < src) {
c0108ab9:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0108abc:	3b 45 ec             	cmp    -0x14(%ebp),%eax
c0108abf:	73 42                	jae    c0108b03 <memmove+0x65>
c0108ac1:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0108ac4:	89 45 e4             	mov    %eax,-0x1c(%ebp)
c0108ac7:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0108aca:	89 45 e0             	mov    %eax,-0x20(%ebp)
c0108acd:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0108ad0:	89 45 dc             	mov    %eax,-0x24(%ebp)
        "andl $3, %%ecx;"
        "jz 1f;"
        "rep; movsb;"
        "1:"
        : "=&c" (d0), "=&D" (d1), "=&S" (d2)
        : "0" (n / 4), "g" (n), "1" (dst), "2" (src)
c0108ad3:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0108ad6:	c1 e8 02             	shr    $0x2,%eax
c0108ad9:	89 c1                	mov    %eax,%ecx
#ifndef __HAVE_ARCH_MEMCPY
#define __HAVE_ARCH_MEMCPY
static inline void *
__memcpy(void *dst, const void *src, size_t n) {
    int d0, d1, d2;
    asm volatile (
c0108adb:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c0108ade:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0108ae1:	89 d7                	mov    %edx,%edi
c0108ae3:	89 c6                	mov    %eax,%esi
c0108ae5:	f3 a5                	rep movsl %ds:(%esi),%es:(%edi)
c0108ae7:	8b 4d dc             	mov    -0x24(%ebp),%ecx
c0108aea:	83 e1 03             	and    $0x3,%ecx
c0108aed:	74 02                	je     c0108af1 <memmove+0x53>
c0108aef:	f3 a4                	rep movsb %ds:(%esi),%es:(%edi)
c0108af1:	89 f0                	mov    %esi,%eax
c0108af3:	89 fa                	mov    %edi,%edx
c0108af5:	89 4d d8             	mov    %ecx,-0x28(%ebp)
c0108af8:	89 55 d4             	mov    %edx,-0x2c(%ebp)
c0108afb:	89 45 d0             	mov    %eax,-0x30(%ebp)
        "rep; movsb;"
        "1:"
        : "=&c" (d0), "=&D" (d1), "=&S" (d2)
        : "0" (n / 4), "g" (n), "1" (dst), "2" (src)
        : "memory");
    return dst;
c0108afe:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0108b01:	eb 36                	jmp    c0108b39 <memmove+0x9b>
    asm volatile (
        "std;"
        "rep; movsb;"
        "cld;"
        : "=&c" (d0), "=&S" (d1), "=&D" (d2)
        : "0" (n), "1" (n - 1 + src), "2" (n - 1 + dst)
c0108b03:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0108b06:	8d 50 ff             	lea    -0x1(%eax),%edx
c0108b09:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0108b0c:	01 c2                	add    %eax,%edx
c0108b0e:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0108b11:	8d 48 ff             	lea    -0x1(%eax),%ecx
c0108b14:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0108b17:	8d 1c 01             	lea    (%ecx,%eax,1),%ebx
__memmove(void *dst, const void *src, size_t n) {
    if (dst < src) {
        return __memcpy(dst, src, n);
    }
    int d0, d1, d2;
    asm volatile (
c0108b1a:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0108b1d:	89 c1                	mov    %eax,%ecx
c0108b1f:	89 d8                	mov    %ebx,%eax
c0108b21:	89 d6                	mov    %edx,%esi
c0108b23:	89 c7                	mov    %eax,%edi
c0108b25:	fd                   	std    
c0108b26:	f3 a4                	rep movsb %ds:(%esi),%es:(%edi)
c0108b28:	fc                   	cld    
c0108b29:	89 f8                	mov    %edi,%eax
c0108b2b:	89 f2                	mov    %esi,%edx
c0108b2d:	89 4d cc             	mov    %ecx,-0x34(%ebp)
c0108b30:	89 55 c8             	mov    %edx,-0x38(%ebp)
c0108b33:	89 45 c4             	mov    %eax,-0x3c(%ebp)
        "rep; movsb;"
        "cld;"
        : "=&c" (d0), "=&S" (d1), "=&D" (d2)
        : "0" (n), "1" (n - 1 + src), "2" (n - 1 + dst)
        : "memory");
    return dst;
c0108b36:	8b 45 f0             	mov    -0x10(%ebp),%eax
            *d ++ = *s ++;
        }
    }
    return dst;
#endif /* __HAVE_ARCH_MEMMOVE */
}
c0108b39:	83 c4 30             	add    $0x30,%esp
c0108b3c:	5b                   	pop    %ebx
c0108b3d:	5e                   	pop    %esi
c0108b3e:	5f                   	pop    %edi
c0108b3f:	5d                   	pop    %ebp
c0108b40:	c3                   	ret    

c0108b41 <memcpy>:
 * it always copies exactly @n bytes. To avoid overflows, the size of arrays pointed
 * by both @src and @dst, should be at least @n bytes, and should not overlap
 * (for overlapping memory area, memmove is a safer approach).
 * */
void *
memcpy(void *dst, const void *src, size_t n) {
c0108b41:	55                   	push   %ebp
c0108b42:	89 e5                	mov    %esp,%ebp
c0108b44:	57                   	push   %edi
c0108b45:	56                   	push   %esi
c0108b46:	83 ec 20             	sub    $0x20,%esp
c0108b49:	8b 45 08             	mov    0x8(%ebp),%eax
c0108b4c:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0108b4f:	8b 45 0c             	mov    0xc(%ebp),%eax
c0108b52:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0108b55:	8b 45 10             	mov    0x10(%ebp),%eax
c0108b58:	89 45 ec             	mov    %eax,-0x14(%ebp)
        "andl $3, %%ecx;"
        "jz 1f;"
        "rep; movsb;"
        "1:"
        : "=&c" (d0), "=&D" (d1), "=&S" (d2)
        : "0" (n / 4), "g" (n), "1" (dst), "2" (src)
c0108b5b:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0108b5e:	c1 e8 02             	shr    $0x2,%eax
c0108b61:	89 c1                	mov    %eax,%ecx
#ifndef __HAVE_ARCH_MEMCPY
#define __HAVE_ARCH_MEMCPY
static inline void *
__memcpy(void *dst, const void *src, size_t n) {
    int d0, d1, d2;
    asm volatile (
c0108b63:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0108b66:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0108b69:	89 d7                	mov    %edx,%edi
c0108b6b:	89 c6                	mov    %eax,%esi
c0108b6d:	f3 a5                	rep movsl %ds:(%esi),%es:(%edi)
c0108b6f:	8b 4d ec             	mov    -0x14(%ebp),%ecx
c0108b72:	83 e1 03             	and    $0x3,%ecx
c0108b75:	74 02                	je     c0108b79 <memcpy+0x38>
c0108b77:	f3 a4                	rep movsb %ds:(%esi),%es:(%edi)
c0108b79:	89 f0                	mov    %esi,%eax
c0108b7b:	89 fa                	mov    %edi,%edx
c0108b7d:	89 4d e8             	mov    %ecx,-0x18(%ebp)
c0108b80:	89 55 e4             	mov    %edx,-0x1c(%ebp)
c0108b83:	89 45 e0             	mov    %eax,-0x20(%ebp)
        "rep; movsb;"
        "1:"
        : "=&c" (d0), "=&D" (d1), "=&S" (d2)
        : "0" (n / 4), "g" (n), "1" (dst), "2" (src)
        : "memory");
    return dst;
c0108b86:	8b 45 f4             	mov    -0xc(%ebp),%eax
    while (n -- > 0) {
        *d ++ = *s ++;
    }
    return dst;
#endif /* __HAVE_ARCH_MEMCPY */
}
c0108b89:	83 c4 20             	add    $0x20,%esp
c0108b8c:	5e                   	pop    %esi
c0108b8d:	5f                   	pop    %edi
c0108b8e:	5d                   	pop    %ebp
c0108b8f:	c3                   	ret    

c0108b90 <memcmp>:
 *   match in both memory blocks has a greater value in @v1 than in @v2
 *   as if evaluated as unsigned char values;
 * - And a value less than zero indicates the opposite.
 * */
int
memcmp(const void *v1, const void *v2, size_t n) {
c0108b90:	55                   	push   %ebp
c0108b91:	89 e5                	mov    %esp,%ebp
c0108b93:	83 ec 10             	sub    $0x10,%esp
    const char *s1 = (const char *)v1;
c0108b96:	8b 45 08             	mov    0x8(%ebp),%eax
c0108b99:	89 45 fc             	mov    %eax,-0x4(%ebp)
    const char *s2 = (const char *)v2;
c0108b9c:	8b 45 0c             	mov    0xc(%ebp),%eax
c0108b9f:	89 45 f8             	mov    %eax,-0x8(%ebp)
    while (n -- > 0) {
c0108ba2:	eb 30                	jmp    c0108bd4 <memcmp+0x44>
        if (*s1 != *s2) {
c0108ba4:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0108ba7:	0f b6 10             	movzbl (%eax),%edx
c0108baa:	8b 45 f8             	mov    -0x8(%ebp),%eax
c0108bad:	0f b6 00             	movzbl (%eax),%eax
c0108bb0:	38 c2                	cmp    %al,%dl
c0108bb2:	74 18                	je     c0108bcc <memcmp+0x3c>
            return (int)((unsigned char)*s1 - (unsigned char)*s2);
c0108bb4:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0108bb7:	0f b6 00             	movzbl (%eax),%eax
c0108bba:	0f b6 d0             	movzbl %al,%edx
c0108bbd:	8b 45 f8             	mov    -0x8(%ebp),%eax
c0108bc0:	0f b6 00             	movzbl (%eax),%eax
c0108bc3:	0f b6 c0             	movzbl %al,%eax
c0108bc6:	29 c2                	sub    %eax,%edx
c0108bc8:	89 d0                	mov    %edx,%eax
c0108bca:	eb 1a                	jmp    c0108be6 <memcmp+0x56>
        }
        s1 ++, s2 ++;
c0108bcc:	83 45 fc 01          	addl   $0x1,-0x4(%ebp)
c0108bd0:	83 45 f8 01          	addl   $0x1,-0x8(%ebp)
 * */
int
memcmp(const void *v1, const void *v2, size_t n) {
    const char *s1 = (const char *)v1;
    const char *s2 = (const char *)v2;
    while (n -- > 0) {
c0108bd4:	8b 45 10             	mov    0x10(%ebp),%eax
c0108bd7:	8d 50 ff             	lea    -0x1(%eax),%edx
c0108bda:	89 55 10             	mov    %edx,0x10(%ebp)
c0108bdd:	85 c0                	test   %eax,%eax
c0108bdf:	75 c3                	jne    c0108ba4 <memcmp+0x14>
        if (*s1 != *s2) {
            return (int)((unsigned char)*s1 - (unsigned char)*s2);
        }
        s1 ++, s2 ++;
    }
    return 0;
c0108be1:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0108be6:	c9                   	leave  
c0108be7:	c3                   	ret    
